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 ?
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 love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With