forked from spotify/spotify-web-api-ts-sdk
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Existing expired token seem to be removed from local storage instead of being refreshed when the SDK is being initialized.
To replicate:
- Initialize the SDK with PKCE Strategy like usual
const sdk = SpotifyApi.withUserAuthorization(...);- Authenticate and complete the auth redirection normally
sdk.authenticate();- Replace the
expiresvalue stored on the local storage manually using browser's dev console to simulate the token being expired
// get the token value
localStorage.getItem("spotify-sdk:AuthorizationCodeWithPKCEStrategy:token");
// { "access_token": "...", "token_type": "Bearer", "expires_in": 3600, "refresh_token": "...", "scope": "...", "expires": 1708419488712 }
// then replace the token value on the local storage so that the token seems expired
localStorage.getItem(
"spotify-sdk:AuthorizationCodeWithPKCEStrategy:token",
'{ "access_token": "...", "token_type": "Bearer", "expires_in": 3600, "refresh_token": "...", "scope": "...", "expires": 1600000000000 }'
); -
Reload the page so that the SDK is re-initialized again.
-
The token is now removed from the local storage instead of being refreshed and user has to reauthenticate again
// get the token value
localStorage.getItem("spotify-sdk:AuthorizationCodeWithPKCEStrategy:token");
// nullI don't know if this is the intended behaviour.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels