mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 00:25:54 +03:00
[GH-ISSUE #1092] Invalid API id and secret doesn't throw an error until client is used #649
Labels
No labels
api-bug
bug
dependencies
documentation
duplicate
enhancement
external-ide
headless-mode
implicit-grant-flow
invalid
missing-endpoint
pr-welcome
private-api
pull-request
question
spotipy3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotipy#649
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 @JackDyre on GitHub (Apr 29, 2024).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/1092
Using the authorization flow (maybe this is a problem with the other flow as well), if you create an API client with an invalid client secret and / or client ID, it will not throw an error until you try to use the API client.
This makes it difficult to have the user input their API credentials because you cant verify whether they inputted valid credentials
@dieser-niko commented on GitHub (Apr 29, 2024):
You could try out the following:
This would throw the error
spotipy.oauth2.SpotifyOauthErrorif the credentials are incorrect.You might notice that there's a deprecation warning for the attribute
as_dict=True, but you can ignore that since this is actually set toTrueby default. Or just set it toFalseit it annoys you.@JackDyre commented on GitHub (Apr 29, 2024):
That is the credentials flow though, I am wanting to use the authorization flow.
Why doesn't the authorization flow throw an error if the ID and or Secret are invalid?
@dieser-niko commented on GitHub (Apr 29, 2024):
Ah, I see. This is somewhat due to the authorisation flow for OAuth, as it just generates a URL for the user and waits for a response from Spotify via the redirect URI.
I don't quite see a solution that could be done with the SpotifyOAuth manager alone, but you could try using SpotifyClientCredentials just for verification and then initialising with SpotifyOAuth again. Not quite elegant, but it should do the trick.
@JackDyre commented on GitHub (Apr 29, 2024):
Thanks