Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directly provide the dealer token #7

Open
paeolo opened this issue Jun 4, 2021 · 6 comments
Open

Directly provide the dealer token #7

paeolo opened this issue Jun 4, 2021 · 6 comments

Comments

@paeolo
Copy link

paeolo commented Jun 4, 2021

I was reading https://developer.spotify.com/documentation/web-playback-sdk/quick-start/# and it seems that you can use the "Web Playback SDK access token" as a token to connect to the spotify websocket.

I just run their example and indeed, you can ask for a token with the scopes ["streaming", "user-read-email", "user-read-private"] and use it directly to connect to for instance : "wss://gew-dealer.spotify.com/?access_token=MY_TOKEN"

This potentially eliminate the need to use a cookie and enable the possibility to request the token using your favorite OAuth flow. My sugggestion is that the Sactivity class could directly use a token string instead of a cookie string:)

Cheers,

Paul.

@EricRabil
Copy link
Owner

That's awesome! When I have time, I'll go ahead and add support for it. If you want to fork it and add support, go on ahead. It shouldn't be too difficult, except for some bits with audio analysis – however since you are generating a token you can just generate one with audio analysis included.

@EricRabil
Copy link
Owner

The best approach for this would be to create another extension of SpotifySocket that works with access tokens instead of a cookie. Most stuff is already coded to be unaware of how the token is generated, so it should be easy to do. The CoordinatedSpotifySocket is what handles cookies and converting them to tokens.

@paeolo
Copy link
Author

paeolo commented Jun 4, 2021

That's awesome!

lol I had the same reaction:) it seems that spotify are finally willing to enlarge the world of possibilites for the devs

@paeolo
Copy link
Author

paeolo commented Jun 6, 2021

@EricRabil Just tried to use your library with the web token but it seems that this token doesnt grant access to 'https://guc-spclient.spotify.com/connect-state/v1/devices/hobs_${device.device_id}' cause this endpoint respond with a 403. how important is this endpoint ?

@EricRabil
Copy link
Owner

EricRabil commented Jun 6, 2021 via email

@paeolo
Copy link
Author

paeolo commented Jun 7, 2021

@EricRabil I am not sure if the web sdk token is able to observe the shared state, the documentation keeps using the words like "local playback has changed" so unfortunatly maybe it's intentional that it's not possible to use this token for that purpose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants