mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-26 16:15:51 +03:00
[GH-ISSUE #599] "Invalid access token, reason: None" with access token from OAuth #356
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#356
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 @alansberman on GitHub (Oct 28, 2020).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/599
I'm new to both Django and spotipy, and am trying to get my currently playing track.
This is what I have thus far:
it appears I have to include the line
results = sp.search(q='weezer', limit=20)or nothing happens.Anyway, when I click allow on Spotify's popup and get to the callback, with a token, I get the following error
What exactly is going wrong here? Any help would be appreciated, and apologies for the ugly code!
@Peter-Schorn commented on GitHub (Oct 29, 2020):
The variable
codeindef overview(request)is probably the authorization code, as described in the authorization guide, not the access token, which is what theauthparameter ofSpotifyexpects.More importantly, though, why are you trying to implement the authorization process yourself? spotipy already has authorization managers that do that for you:
SpotifyClientCredentials,SpotifyOAuth,SpotifyPKCE, andSpotifyImplicitGrant. You're making things more complicated than they need to be. All you need to do is the following:Do not create a new instance of
Spotifyfor each request, which is what you appear to be doing; that doesn't make sense, because then you will have to go through the authorization process again.Instead, create an instance of
Spotifyas a global variable and use it in each request. If you need more help, you need to post more code. It's hard for me to figure out what exactly you're trying to do, especially given the fact that the functions you posted don't call each other and I have no idea what therequestparameter of theoverviewfunction is.@alansberman commented on GitHub (Oct 29, 2020):
Thanks @Peter-Schorn! Much appreciated.
Everything you're saying makes total sense, and it now works just fine.