mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 16:25:52 +03:00
[GH-ISSUE #242] Can I use a token from spotify web API to create a librespot session? #165
Labels
No labels
A-Alsa
SpotifyAPI
Tokio 1.0
audio
bug
can't reproduce
compilation
dependencies
duplicate
enhancement
good first issue
help wanted
high priority
imported
imported
invalid
new api
pull-request
question
reverse engineering
wiki
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librespot#165
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 @paulo-raca on GitHub (Aug 6, 2018).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/242
Hello,
I'm using the Spotify Web API to crawl artists, albuns, etc, etc, and librespot to playback the tracks.
Right now I have to perform the login twice:
Is it possible to reuse the tokens from the web API or something, so that I don't need to login twice?
Thank you!
@michaelherger commented on GitHub (Aug 6, 2018):
I went the other way around: I'm using librespot to get the token, which I then use to access the web API. It's much simpler, as I didn't have to implement the auth flow. Alas, it's not available from the default librespot application. I implemented it in my "spotty" helper application, which is based on librespot's
main.rsand is using the librespot library. See https://github.com/michaelherger/spotty/blob/master/src/main.rs#L452@ashthespy commented on GitHub (Oct 2, 2018):
@paulo-raca you actually can do this by setting the
auth_typetoAuthenticationType::AUTHENTICATION_SPOTIFY_TOKENand passing a username and a token.@kingosticks commented on GitHub (Oct 2, 2018):
I guess you'll also need to make sure the token you pass has the the streaming scope.
FYI @adamcik
@paulo-raca commented on GitHub (Oct 2, 2018):
Sounds good, thank you!
In this case, the username is the
idfield I get from https://api.spotify.com/v1/me ?@ashthespy commented on GitHub (Oct 2, 2018):
I can dig up an implementation from long ago - but username is just your canonical username.
Just read the WebAPI docs and yes, it is the same id.