Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spotify SDK Missing token refresh service?

I am trying to avoid popup grant permission for user every time session expired in Spotify for SDK.

Pop comes up 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 ?

like image 672
Khodour.F Avatar asked Sep 10 '17 10:09

Khodour.F


1 Answers

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

like image 166
Rach Sharp Avatar answered Nov 20 '22 18:11

Rach Sharp