mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-26 16:15:51 +03:00
[GH-ISSUE #308] I can't get no device id on Spotify API (even if I have a token) #177
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#177
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 @OueOue on GitHub (Jul 24, 2018).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/308
Hi, i'm just trying to start a song on Spotify, I found the way to have a token, but now that I ask for my list of devices, it tells me that the Permission is missing
So here is my code :
import sys
import spotipy
import spotipy.util as util
username = 'OueOue'
token = util.prompt_for_user_token(username, scope = 'user-modify-playback-state', client_id='MyClientID', client_secret='MySecretID', redirect_uri = 'https://open.spotify.com/browse/featured')
if token:
print("Token OK")
sp = spotipy.Spotify(auth=token)
print("Authentication OK")
sp.start_playback(device_id = sp.devices(), context_uri = 'spotify:track:7MywASx2OFZngfoORjo1yy', uris = None, offset = None)
print("SMAH")
else:
print("Can't get token for %s" % username)
Thank you for your time :)
@rperkett-r7 commented on GitHub (Jul 24, 2018):
I doubt it, but tell me if you find the answer to this. Thanks.
@OueOue commented on GitHub (Jul 25, 2018):
I found an unsatisfying solution, get the device ID from :
https://developer.spotify.com/console/put-play/
and click on "fill sample data"
but the problem is that I will only be able to start or resume a playback on my computer, and not on other devices, that's why i'm waiting for another solution
@danitico commented on GitHub (Jul 28, 2018):
Same problem
@OueOue commented on GitHub (Jul 30, 2018):
I GOT THE SOLUTION !
First connect on spotify on all the devices you would like to use (for example your laptop, mobile phone, and your desktop pc), go here : https://developer.spotify.com/console/get-users-available-devices/
Then ask for a token, do Win+cmd , copy the curl request and paste it in cmd :
You'll normally get the list of all the devices currently connected to your spotify account.
Now do an array of string (bi-dimensional array of characters), let's call it Dvcs[3][40].
[3] because I have only 3 IDs, [40] because a device ID is a string of 40 characters.
Fill it with the IDs of your devices, then just do a function in your program that allows you to choose on which device to play the track (like choosing i = 1 or 2 or 3 and then select Dvcs[i][]).
I hope it has been helpful to you guys ! 😄
@rperkett-r7 commented on GitHub (Jul 30, 2018):
I wish there was some way to have the token not have to be manually updated every time :<
@Birath commented on GitHub (Aug 9, 2018):
You need to add
user-read-playback-stateto your scope to read the device id (and other device information). You can find more information about scopes here: https://developer.spotify.com/documentation/general/guides/scopes/@stephanebruckert commented on GitHub (Jan 12, 2020):
Looks like it was a scope problem, closing