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.
Related to #172
Implements token refresh logic in the Spotify authentication service and ensures token validity before playing music.
startRefreshAccessTokenCycle
inapps/website/src/app/services/spotify-authentication/spotify-authentication.service.ts
to call a new methodensureTokenValidity
every 10 minutes instead of refreshing the token every minute. This ensures that the token is checked and refreshed if necessary, maintaining session continuity.ensureTokenValidity
inapps/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.apps/website/src/app/pages/spotify-callback-page/spotify-authentication-callback.component.ts
to callensureTokenValidity
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.