mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 00:25:54 +03:00
[GH-ISSUE #779] How to check whether client id and client secret are correct before actually calling the API? #478
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#478
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 @clemwo on GitHub (Feb 2, 2022).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/779
In my program I would like to check whether the supplied client id and client secret are correct before actually using them to add songs to playlists, etc.
Is there are special function to check whether stuff is correct?
My issue is that I would like to check the credentials at the start of the program and not when it is running and trying to call the API with incorrect credentials.
My code looks like this:
This feels very hacky and I would like to know whether I can simply use a function to check.
@Peter-Schorn commented on GitHub (Feb 2, 2022):
The only way to check if the client id and secret are correct is to attempt to go through the authorization process. The web API is designed with the assumption that the client id and secret are hardcoded into the program (or, at least, they don't change at runtime) by the developer of that program, who knows if the values are correct.
@clemwo commented on GitHub (Feb 2, 2022):
Thanks for the reply. So my somewhat 'hacky' solution is the best one under the circumstances, right?
@Peter-Schorn commented on GitHub (Feb 2, 2022):
Yes.