How to refresh an access token every once in a while?

How to refresh Access Token on Spotify SDK for Android?

  • I'm making an Android's app using https://github.com/spotify/android-sdk and https://github.com/kaaes/spotify-web-api-android from kaaes. What's the best way to refresh my access token? Since i need to keep the user logged. I don't want that my app ask for log in everytime the users open the app. How can I handle this ? retrofit.RetrofitError: 401 Unauthorized Login to Spotify failed because of invalid credentials Thanks for your time and help! Regards.

  • Answer:

    You need to use the Authorization Code flow from the Spotify Web API to obtain a refresh token that you can use to obtain a new access token when yours expires. For that you need to have a web service with which you communicate from the Android app. There is more information on this on https://github.com/spotify/android-sdk/issues/47

Maverick.pe at Stack Overflow Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.