Tuesday, September 26, 2017

Spotify SDK Missing token refresh service?

Leave a Comment

i am trying to void popup grant permission for user every time session expired in Spotify for SDK , after one hour maybe a popup appear to grant permission again to user so he can play tracks from Spotify on my app , the Error i am getting when try to renew the session :

[PLAYER][PLAY][SPOTIFY] Error renew Session Optional(Error Domain=com.spotify.auth Code=0 "Missing token refresh service." UserInfo={NSLocalizedDescription=Missing token refresh service.}) [PLAYER][SPOTIFY] Session could not be renewed,popup login 

and here how i am trying to renew the session :

//Renew Session func renewSession(completion:@escaping (Bool)->()) {     print("[PLAYER][PLAY][SPOTIFY] Renew Session requested ")      let auth = SPTAuth.defaultInstance()         auth?.renewSession(auth?.session, callback: { (error, session) in              if (error != nil)             {                 print("[PLAYER][PLAY][SPOTIFY] Error renew Session \(String(describing: error))")                 completion(false)                 return             }              auth?.session = session              if auth?.session.isValid() == true             {                 print("[PLAYER][PLAY][SPOTIFY] Renew Session Success")                 completion(true)             }else             {                 print("[PLAYER][PLAY][SPOTIFY] Renew Session Failed")                 completion(false)             }     })  } 

any solution for this ?

1 Answers

Answers 1

Have you assigned these properties on your SPTAuth object?

[SPTAuth defaultInstance].tokenSwapURL = [NSURL URLWithString:@"swapURL"]; [SPTAuth defaultInstance].tokenRefreshURL = [NSURL URLWithString:@"refreshURL"];

Taken from https://github.com/spotify/ios-sdk/issues/427 which might have more info if that isn't sufficient.

There's also a reference for the SPTAuth class:

https://spotify.github.io/ios-sdk/Classes/SPTAuth.html

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment