[GH-ISSUE #22] Retrieve token through API #13

Closed
opened 2026-02-28 14:24:41 +03:00 by kerem · 8 comments
Owner

Originally created by @txoof on GitHub (Feb 26, 2024).
Original GitHub issue: https://github.com/devgianlu/go-librespot/issues/22

Is it possible to retrieve the token through the API?

In librespot-java it is possible to fetch a token that can be used for interacting with the spotify API.

I don't see that in the documentation, but I may be misreading it or looking in the wrong place.

Originally created by @txoof on GitHub (Feb 26, 2024). Original GitHub issue: https://github.com/devgianlu/go-librespot/issues/22 Is it possible to retrieve the token through the API? In librespot-java it is possible to [fetch a token](https://github.com/librespot-org/librespot-java/blob/dev/api/README.md#tokens) that can be used for interacting with the spotify API. I don't see that in the documentation, but I may be misreading it or looking in the wrong place.
kerem 2026-02-28 14:24:41 +03:00
Author
Owner

@devgianlu commented on GitHub (Feb 28, 2024):

librespot-java uses the Mercury endpoint /keymaster/token/authenticated to generate token, but that does not seem to exist on spclient. go-librespot does not implement Mercury because it is an outdated Spotify API that I did not implement purposely.

Not sure if there's another way to achieve this same result through another way, but that needs investigation.

<!-- gh-comment-id:1968479326 --> @devgianlu commented on GitHub (Feb 28, 2024): `librespot-java` uses the Mercury endpoint `/keymaster/token/authenticated` to generate token, but that does not seem to exist on spclient. `go-librespot` does not implement Mercury because it is an outdated Spotify API that I did not implement purposely. Not sure if there's another way to achieve this same result through another way, but that needs investigation.
Author
Owner

@txoof commented on GitHub (Feb 28, 2024):

@devgianlu Thanks for explaining. If there's a way to do this, I would find it super helpful.

I'm also happy to test and work with this as you go.

<!-- gh-comment-id:1968542538 --> @txoof commented on GitHub (Feb 28, 2024): @devgianlu Thanks for explaining. If there's a way to do this, I would find it super helpful. I'm also happy to test and work with this as you go.
Author
Owner

@txoof commented on GitHub (Feb 28, 2024):

Specifically, I'm interested in getting the higher resolution album art. Right now it looks like just the low resolution images are returned through the current go-librespot API.

I have an e-paper project that displays the now-playing artwork and I'd like the higher resolution images if I can get to them.

<!-- gh-comment-id:1969808218 --> @txoof commented on GitHub (Feb 28, 2024): Specifically, I'm interested in getting the higher resolution album art. Right now it looks like just the low resolution images are returned through the current go-librespot API. I have an e-paper project that displays the now-playing artwork and I'd like the higher resolution images if I can get to them.
Author
Owner

@devgianlu commented on GitHub (Mar 3, 2024):

For the moment you might be able to retrieve those images from the official API and your own client app: https://developer.spotify.com/documentation/web-api/reference/get-an-album

<!-- gh-comment-id:1975278725 --> @devgianlu commented on GitHub (Mar 3, 2024): For the moment you might be able to retrieve those images from the official API and your own client app: https://developer.spotify.com/documentation/web-api/reference/get-an-album
Author
Owner

@txoof commented on GitHub (Mar 4, 2024):

That was my original plan and it works well.

The beauty of librespot zero config is ... zero configuration and no requirement for end users to need additional setup. I love this feature so much! Even the lower-resolution images are "good enough" for most use cases in terms of this project.

<!-- gh-comment-id:1976048319 --> @txoof commented on GitHub (Mar 4, 2024): That was my original plan and it works well. The beauty of librespot zero config is ... zero configuration and no requirement for end users to need additional setup. I love this feature so much! Even the lower-resolution images are "good enough" for most use cases in terms of this project.
Author
Owner

@felixstorm commented on GitHub (Sep 16, 2024):

@devgianlu Is there any reason why we should not use the token we get from login5 and that go-librespot uses to authorize to the web api also for passthrough-requests received by the go-librespot API?

I implemented an API endpoint for it and during a few short tests it seems to work without any issues so far: github.com/felixstorm/go-librespot@24707f74e5
If you would like me to I will be happy to open a PR for it.

<!-- gh-comment-id:2352052081 --> @felixstorm commented on GitHub (Sep 16, 2024): @devgianlu Is there any reason why we should not use the token we get from login5 and that go-librespot uses to authorize to the web api also for passthrough-requests received by the go-librespot API? I implemented an API endpoint for it and during a few short tests it seems to work without any issues so far: https://github.com/felixstorm/go-librespot/commit/24707f74e56f872379e910b031feb8161e4ef71c If you would like me to I will be happy to open a PR for it.
Author
Owner

@devgianlu commented on GitHub (Sep 16, 2024):

@devgianlu Is there any reason why we should not use the token we get from login5 and that go-librespot uses to authorize to the web api also for passthrough-requests received by the go-librespot API?

You are right, that should work. The token is even being used for the web API passthrough.

I implemented an API endpoint for it and during a few short tests it seems to work without any issues so far: felixstorm@24707f7
If you would like me to I will be happy to open a PR for it.

@felixstorm Yes! Feel free to open a PR!

<!-- gh-comment-id:2352324633 --> @devgianlu commented on GitHub (Sep 16, 2024): > @devgianlu Is there any reason why we should not use the token we get from login5 and that go-librespot uses to authorize to the web api also for passthrough-requests received by the go-librespot API? You are right, that should work. The token is even being used for the web API passthrough. > I implemented an API endpoint for it and during a few short tests it seems to work without any issues so far: [felixstorm@24707f7](https://github.com/felixstorm/go-librespot/commit/24707f74e56f872379e910b031feb8161e4ef71c) > If you would like me to I will be happy to open a PR for it. @felixstorm Yes! Feel free to open a PR!
Author
Owner

@txoof commented on GitHub (Sep 17, 2024):

I'm eager to test this out if that's helpful.

<!-- gh-comment-id:2354535208 --> @txoof commented on GitHub (Sep 17, 2024): I'm eager to test this out if that's helpful.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/go-librespot#13
No description provided.