ufosc/Jukebox-Server

Create Logic for Refresh Tokens

Closed this issue · 0 comments

Info

Currently, when you log in with Spotify the access token is stored inside a cookie - allowing the user to work with spotify as long as the access code is valid. Once this access code expires, the user will need to log in again. This happens every 60 minutes, and is very inconvenient.

In their API, spotify also sends a "refresh token", which can be used to obtain a new access token automatically so the user doesn't need to log in again.

Task

Use the following as a general guide:

  • Store refresh token inside a cookie (later this may be stored inside a user model)
  • Create logic to get new access token from spotify via refresh token
  • Switch out the access token after new one has been obtained
  • Make this happen automatically so you only need to sign in once