Closed NDoolan360 closed 1 year ago
I think the refresh token logic the pkce
just borrowed from auth_code.rs
, we should replace the old refresh token with the new fresh token retuned by the request.
The new refresh token is overwritten by the retained refresh token in line 77 of auth_code_pkce.rs of https://github.com/ramsayleung/rspotify/blob/4360c096f2e1d827bd52b998dc3c1bfde18c456d/src/auth_code_pkce.rs Removing that line seems to fix this issue
The PKCE protocol invalidates the old refresh token, due to a protection against token extraction. The token refresh also gives a new refresh token and remembers the old refresh token, so in case a refresh is issued with the old refresh token the whole session is invalidated.
This problem has been fixed, feel free to retry with the latest commit :)
Describe the bug The
refetch_token
method in theBaseClient
ofAuthCodePkceSpotify
keeps the original refresh_token after refetching causing an error response with Status 400 (Bad Request)To Reproduce Steps to reproduce the behavior:
token_cache
Expected behavior I expect the new refresh token returned by the request to be returned by
refetch_token
and stored in the cache byrefresh_token
.Log/Output data log.txt From recreating the request in postman the body is:
Additional context This appears to occur because of auth_code_pkce.rs line 75
Spotify Community Discussion
Is this just to do with my use case? Do we know why it is that we need to keep the same refresh_token after the refetch?