mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-26 16:15:51 +03:00
[GH-ISSUE #504] Error 401: No token provided #302
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#302
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 @ElementO2512 on GitHub (May 29, 2020).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/504
Hey,
Basically when ever I try to run this script I get a 'No token provided' error.
Heres my code:
`import spotipy
#import python-util
import os
from spotipy.oauth2 import SpotifyClientCredentials
os.environ["SPOTIPY_CLIENT_ID"] = "(my client id)"
os.environ["SPOTIPY_CLIENT_SECRET"] = "(my client secret)"
client_credentials_manager = SpotifyClientCredentials()
sp = spotipy.Spotify(client_credentials_manager=SpotifyClientCredentials())
spotipy.prompt_for_user_token(username='', scope='', client_id='(my client id)', client_secret='(my client secret)', redirect_uri='http://localhost:9090')
spp = spotipy.Spotify()
songinfo = spp.current_playback(market=None)
print('songinfo')`
What code do I need to add to make this work?
@anpanval commented on GitHub (May 29, 2020):
Hello,
I have the same issue today, everything worked well yesterday with the same code.
@ysinjab commented on GitHub (May 29, 2020):
Hi, you are using spp = spotipy.Spotify() without passing any of: auth, client_credentials_manager, oauth_manager, auth_manager.
auth is the token.
auth_manager is either client_credentials_manager or oauth_manager
@ElementO2512 commented on GitHub (May 30, 2020):
Hey Thanks for the Answer
Realised Im really retarded and already had the right thing but wasn't using it
My code now looks like this:
`
import spotipy
import os
from spotipy.oauth2 import SpotifyClientCredentials
os.environ["SPOTIPY_CLIENT_ID"] = "(my client id)"
os.environ["SPOTIPY_CLIENT_SECRET"] = "(my client secret)"
client_credentials_manager = SpotifyClientCredentials()
sp = spotipy.Spotify(client_credentials_manager=SpotifyClientCredentials())
spotipy.prompt_for_user_token(username='', scope='user-read-currently-playing', client_id='(my client id)', client_secret='(my client secret)', redirect_uri='http://localhost:9090')
songinfo = sp.current_playback(market=None)
print('songinfo')
`
I'm now getting a 404 Invalid username error. I'm guessing this is because
username=''is blank. What should I put here?@stephanebruckert commented on GitHub (Jun 14, 2020):
We just deprecated
prompt_for_user_token, check out this example https://github.com/plamere/spotipy#with-user-authentication, this is all you need: