mirror of
https://github.com/ramsayleung/rspotify.git
synced 2026-04-25 23:45:52 +03:00
[GH-ISSUE #358] prompt_for_token returns error if token refresh fails #109
Labels
No labels
Stale
bug
discussion
enhancement
good first issue
good first issue
help wanted
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/rspotify#109
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jacobmichels on GitHub (Aug 14, 2022).
Original GitHub issue: https://github.com/ramsayleung/rspotify/issues/358
Describe the bug
Using the
AuthCodePkceSpotifyclient with token cache enabled, if the cached refresh token expires or is invalid, prompt_for_token returns an errorhttp error: status code 400 Bad Requestinstead of opening the browser to get a new access/refresh token pair. To work around this I've had to delete the token cache and re-run prompt_for_token:To Reproduce
Steps to reproduce the behavior:
Using an
AuthCodePkceSpotifyclient configured withtoken_cacheandtoken_refreshingenabled:prompt_for_tokenand following the instructionsprompt_for_tokenon the client and observe the returned error instead of the expected behavior of re-prompting the user for the redirect URIExpected behavior
As the method description states, I expect prompt_for_token to open the web browser and re-prompt the user for the redirect URI
Log/Output data
Additional context
I'm unsure if this issue happens with any other auth clients, I've only used the PKCE flow. Happy to provide more info or an example program showcasing the issue.
@ramsayleung commented on GitHub (Sep 2, 2022):
Hi @jacobmichels, thanks for your report, I think it's an issue that we need to fix, the
prompt_for_tokendoesn't handle the exception case well.prompt_for_tokenshould handle it more elegantly, just refetch the token and the update the cache.github.com/ramsayleung/rspotify@2aca7c67ff/src/clients/oauth.rs (L156)@github-actions[bot] commented on GitHub (Jun 24, 2023):
Message to comment on stale issues. If none provided, will not mark issues stale