librespot-python icon indicating copy to clipboard operation
librespot-python copied to clipboard

[REQUEST] Token generation documentation

Open sa7mon opened this issue 3 years ago • 2 comments

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!

sa7mon avatar Feb 17 '22 23:02 sa7mon

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

kokarare1212 avatar Feb 18 '22 00:02 kokarare1212

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: @.***>

sa7mon avatar Feb 19 '22 00:02 sa7mon