How to use OAuth token to successfully add user with zeroconf authentication #882
Replies: 5 comments 4 replies
-
Moved to discussion. |
Beta Was this translation helpful? Give feedback.
-
There is this discussion from earlyer this year that is pretty much about what I was aiming for: #495 Am I right, that the zeroconf So I need: The blob, made from librespot public key and another pair of keys, Creating the blob is still a mystery to me but: I also found that there is a librespot python version (Nice!). I will have a closer look into decrypt_blob function and handle_add_user. If anyone sees I'm going the wrong direction please stop me =) |
Beta Was this translation helpful? Give feedback.
-
Finally from what I could find there is no working example for adding/changing the user through the zeroconf endpoint. Not without a previous connect operation using one of the official spotify apps. Still I would like to keep up my monologue for a little bit 😉 There seems to be a different approach to use an exisitng OAuth token instead of username/password credentials: #242 (comment) But if I get it right this can only be achived with changes to the librespot source code. So before I stop at this point let me ask this final question: Is that so, or is there any chance I can forward an existiing Spotify client API token for same user and on the same machine to librespot? |
Beta Was this translation helpful? Give feedback.
-
As I mentioned in that thread you linked I decided not to have the user to enter credentials at all, but simply use a Spotify app to authenticate. Then I call librespot to get a session which I can use with the web API to interact with Spotify's servers. There's even an example how to do this in this repo (https://github.com/librespot-org/librespot/blob/dev/examples/get_token.rs). |
Beta Was this translation helpful? Give feedback.
-
Thanks for your reply! Using a Spotify App to authenticate would realy be the best option! Thanks for being redundant here, I did not consider your proposal yet because I didn't understand how to access/customize librespot apart from options and have never worked with rust. I installed librespot using raspotify thats why I never got in touch with cargo. I got the get_token example to print me a token using my user credentials and client id. I would have thougt that it is not possible to create a non OAuth token that can access the How would I go forward to get/generate the token after librespot was connected via a Spotify API? I could not figure out how to omit user and password and have a persistent librespot session. And how can I get librespot to also reuse this token on restart? |
Beta Was this translation helpful? Give feedback.
-
I have a working librespot setup that uses user authentication via librespot options
--username
and--password
. Since I use Oauth for my spotify api player to control the librespot device, a user of the player app has to enter password twice. Once for Oauth and then again so that I can bind librespot to the user with user/password authentication.I was very happy when I found the docs on the alternative zerconf authentication method. This seems to be exactly what I need.
I figured how to discover my librespot device with zeroconf and get a proper result requesting
action=getInfo
But here my understanding comes to an end. I feel far from understanding how I use the
addUser
action.What are the names of the additional parameters and how do I generate the
blob
having my client Oauth token and the librespot device public key?I would be very happy for any kind of hint or additional information. It seems I'm so close yet stuck.
I use spotipy to make the player api calls and generate the oauth token so any example in python would help me a great deal!
Beta Was this translation helpful? Give feedback.
All reactions