Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spotify credentials expire if page not refreshed #119

Closed
1 task done
IkeHunter opened this issue Nov 5, 2024 · 1 comment
Closed
1 task done

Spotify credentials expire if page not refreshed #119

IkeHunter opened this issue Nov 5, 2024 · 1 comment
Labels
integration Involves connecting to the backend server and managing data between both

Comments

@IkeHunter
Copy link
Collaborator

IkeHunter commented Nov 5, 2024

Problem

After about an hour of listening to music, the spotify credentials will expire, and will only refresh if the user refreshes the page.

Possible solutions

  • Set a timer for less than 1h to auto refresh the token
  • When spotify web player throws an unauthorized error, make a request to refresh the token
  • Use the preexisting api route defined in Network.sendGetSpotifyToken, this will always return an updated token

Task

  • Automatically refresh the spotify credentials when/before the token expires

Note: You will need to run the project in network mode, I recommend setting the servers like this: https://github.com/ufosc/Jukebox-Server/blob/main/docs/Network-Mode.md, then running npm run network in the terminal. Alternatively, you can run docker-compose -f docker-compose.network.yml up, but this makes logs harder to read in the terminal.

@IkeHunter IkeHunter added the integration Involves connecting to the backend server and managing data between both label Nov 5, 2024
@IkeHunter
Copy link
Collaborator Author

Strategy used: every 5 minutes the client will check spotify credentials, if they expire in less than 5 minutes the client requests refreshed credentials from the server. This also uses force-refreshing on the backend to refresh the tokens even if they are not expired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration Involves connecting to the backend server and managing data between both
Projects
None yet
Development

No branches or pull requests

1 participant