[GH-ISSUE #116] [REQUEST] Token generation documentation #13

Closed
opened 2026-02-27 08:11:26 +03:00 by kerem · 2 comments
Owner

Originally created by @sa7mon on GitHub (Feb 17, 2022).
Original GitHub issue: https://github.com/kokarare1212/librespot-python/issues/116

Is your feature request related to a problem? Please describe.
Not really a problem, just wondering if there could be some documentation on how the process works to take the credentials and generate a token from them.

Describe the solution you'd like
I'm working on a Golang app that has a component which needs to query Show info from Spotify. The auth schemes offered by libraries like zmb3/spotify assume the app is a web app and the user will interact with it - this is not the case with my CLI app.

Your library is the best one I've found so far to just take usename+password and generate a valid token for the API. Since my app is in Go, I was hoping to implement a purely Go solution but am struggling to follow the flow through this library.

Anything you can provide about how the process generally works would be greatly appreciated. I understand the library needs to hit 3 different apresolve endpoints - I can see that in the network traffic - but after that I'm a bit lost. I know Protobuf is involved, but not sure how.

Describe alternatives you've considered
If I have to, I could shell out and run a simple Python script using this library to get the token, but I'd really like to avoid that if possible.

Additional context
Thanks for the great library!

Originally created by @sa7mon on GitHub (Feb 17, 2022). Original GitHub issue: https://github.com/kokarare1212/librespot-python/issues/116 **Is your feature request related to a problem? Please describe.** Not really a problem, just wondering if there could be some documentation on how the process works to take the credentials and generate a token from them. **Describe the solution you'd like** I'm working on a Golang app that has a component which needs to query Show info from Spotify. The auth schemes offered by libraries like zmb3/spotify assume the app is a web app and the user will interact with it - this is not the case with my CLI app. Your library is the best one I've found so far to just take usename+password and generate a valid token for the API. Since my app is in Go, I was hoping to implement a purely Go solution but am struggling to follow the flow through this library. Anything you can provide about how the process generally works would be greatly appreciated. I understand the library needs to hit 3 different apresolve endpoints - I can see that in the network traffic - but after that I'm a bit lost. I know Protobuf is involved, but not sure how. **Describe alternatives you've considered** If I have to, I could shell out and run a simple Python script using this library to get the token, but I'd really like to avoid that if possible. **Additional context** Thanks for the great library!
kerem 2026-02-27 08:11:26 +03:00
Author
Owner

@kokarare1212 commented on GitHub (Feb 18, 2022):

ApResolver's accesspoint is used to connect to a tcp socket.
After an internal key exchange, the user is authenticated with a username and password.
The token is obtained by using a special protocol called hm.
https://github.com/kokarare1212/librespot-python/blob/rewrite/librespot/mercury.py#L303-L308
Also, the source code of this repository is not well organized, so it may be easier to refer to the original repository.
https://github.com/librespot-org/librespot-java

<!-- gh-comment-id:1043664550 --> @kokarare1212 commented on GitHub (Feb 18, 2022): ApResolver's accesspoint is used to connect to a tcp socket. After an internal key exchange, the user is authenticated with a username and password. The token is obtained by using a special protocol called hm. https://github.com/kokarare1212/librespot-python/blob/rewrite/librespot/mercury.py#L303-L308 Also, the source code of this repository is not well organized, so it may be easier to refer to the original repository. https://github.com/librespot-org/librespot-java
Author
Owner

@sa7mon commented on GitHub (Feb 19, 2022):

Thanks, this helps

On Thu, Feb 17, 2022 at 6:11 PM, 碧舞 すみほ @.***> wrote:

ApResolver's accesspoint is used to connect to a tcp socket.
After an internal key exchange, the user is authenticated with a username and password.
The token is obtained by using a special protocol called hm.
https://github.com/kokarare1212/librespot-python/blob/rewrite/librespot/mercury.py#L303-L308
Also, the source code of this repository is not well organized, so it may be easier to refer to the original repository.
https://github.com/librespot-org/librespot-java


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you authored the thread.Message ID: @.***>

<!-- gh-comment-id:1045389875 --> @sa7mon commented on GitHub (Feb 19, 2022): Thanks, this helps On Thu, Feb 17, 2022 at 6:11 PM, 碧舞 すみほ ***@***.***> wrote: > ApResolver's accesspoint is used to connect to a tcp socket. > After an internal key exchange, the user is authenticated with a username and password. > The token is obtained by using a special protocol called hm. > https://github.com/kokarare1212/librespot-python/blob/rewrite/librespot/mercury.py#L303-L308 > Also, the source code of this repository is not well organized, so it may be easier to refer to the original repository. > https://github.com/librespot-org/librespot-java > > — > Reply to this email directly, [view it on GitHub](https://github.com/kokarare1212/librespot-python/issues/116#issuecomment-1043664550), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AA4KJYWHMMVVMBUBIYO44QLU3WFEHANCNFSM5OWFQIPQ). > Triage notifications on the go with GitHub Mobile for [iOS](https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675) or [Android](https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub). > You are receiving this because you authored the thread.Message ID: ***@***.***>
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/librespot-python-kokarare1212#13
No description provided.