2

How do I indefinitely refresh the access token using JMPerez's web api. I use Spotify's Web API tutorial to get the authorization code flow login. But that login only happens once so I get the access token and refresh token once after logging in. How would I continuously refresh the access token?

For now I just redirect to login page when access token times out

Surya
  • 576
  • 1
  • 4
  • 16
  • 1
    If you use the `refresh_token` you can easily get a new access token once the current one has expired. Check out the [documentation on authorization](https://developer.spotify.com/documentation/general/guides/authorization-guide/) which includes information on how long the current `access_token` lasts and when you can use the `refresh_token` – Kevin Guebert Jun 17 '20 at 17:06
  • @KevinGuebert I read through the documentation but the documentation doesn't exactly show how to keep refreshing the token. I followed their authorization flow code and I have access to the access token and refresh tokens. But how do i keep updating the refresh token each hour is my question so i can replace the access token with it – Surya Jun 18 '20 at 16:53
  • @KevinGuebert I'm getting the access and refresh tokens from the url after logging in, but after navigating through components (reactJS), the url of the access/refresh token will be lost and I'm not sure how to get new refresh tokens after the access token expires – Surya Jun 19 '20 at 01:43

0 Answers0