Skip to content

Refresh Spotify token to prevent unauthorized errors#183

Draft
Staijn1 wants to merge 3 commits intomasterfrom
refresh-spotify-token
Draft

Refresh Spotify token to prevent unauthorized errors#183
Staijn1 wants to merge 3 commits intomasterfrom
refresh-spotify-token

Conversation

@Staijn1
Copy link
Copy Markdown
Owner

@Staijn1 Staijn1 commented May 2, 2024

Related to #172

Implements token refresh logic in the Spotify authentication service and ensures token validity before playing music.

  • Token Refresh Logic: Modifies startRefreshAccessTokenCycle in apps/website/src/app/services/spotify-authentication/spotify-authentication.service.ts to call a new method ensureTokenValidity every 10 minutes instead of refreshing the token every minute. This ensures that the token is checked and refreshed if necessary, maintaining session continuity.
  • Token Validity Check: Adds a new method ensureTokenValidity in apps/website/src/app/services/spotify-authentication/spotify-authentication.service.ts that checks if the current token is close to expiration and refreshes it if necessary. This method is invoked before attempting to play music, ensuring that the token is valid.
  • Authentication Flow Adjustment: Updates apps/website/src/app/pages/spotify-callback-page/spotify-authentication-callback.component.ts to call ensureTokenValidity before completing the login process. This ensures that the token is valid before navigating to the visualizer page.

For more details, open the Copilot Workspace session.

@Staijn1 Staijn1 marked this pull request as draft May 2, 2024 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant