In CocoaLibSpotify, how do I get SPLoginViewController to store credentials, so users later can login automatically via [[SPSession sharedSession] attemptLoginWithStoredCredentials:]?
相关问题
- Is there a way to play audio on a mobile browser w
- How to know when the user changes the song with th
- Monitoring Spotify track change in Applescript?
- Newest Spotify update: Autohotkeys script broke
- launchWebAuthFlow with Spotify returns “Authorizat
相关文章
- Spotify API Create Temp Playlist Not Loading
- How to refresh Access Token on Spotify SDK for And
- Spotify session management
- Update on Spotify API not allowing auto play
- How to change BPM value of Spotify Song Swift
- Get current song playing in Spotify on iPhone
- Get spotify currently playing track
- Starting a Song from Spotify Intent
You don't.
Instead, implement the
SPSessionDelegate
method-session:didGenerateLoginCredentials:forUserName:
and store the credentials inNSUserDefaults
or whatever (the given credentials are already encrypted and safe for storing in cleartext).Next time your app launches, if you have available credentials skip
SPLoginViewController
entirely and login usingSPSession
'sattemptLoginWithUserName:existingCredential:rememberCredentials:
method. If this generates a login error, the token has been invalidated and you need to ask the user to login again — invalidation can happen if the user changes their password since the token was generated.Note that the
rememberCredentials:
parameters and the oldattemptLoginWithStoredCredentials:
way of doing things is now considered deprecated and will be going away soon.The previous answer is also no longer relevant as the attemptLoginWithUserName:existingCredential:rememberCredentials: method no longer exists (despite it still being referred to in the comments of SPSession.h)
To get setup:
To login automatically or prompt for user auth if not previously logged in:
Callback method for storing credentials when logged in: