librespot-org / librespot

Open Source Spotify client library
MIT License
4.7k stars 573 forks source link

Support token configuration from file system. #1085

Closed GiviMAD closed 1 year ago

GiviMAD commented 1 year ago

Hi, awesome project, just discovered it after thinking there were no replacement for libspotify.

Will be possible to support providing a Spotify token from the filesystem? I have a web application and I would like to use librespot to enable Spotify support when running on desktop through electron (when running on web I use the Spotify Web SDK). So I already have a valid spotify token on the client.

My question is, is it possible to add support in librespot to just gather a token from a file and forget about any authentication just assuming it will always have a valid token there?

Another possibility that will solve my "problem", will be supporting creating the credentials cache file programmatically with a valid refresh token and auth_type 3.

Do you think any of these alternatives can be considered? Or maybe I have a better way to do it that I'm just missing.

Thank you in advance for the help!

roderickvd commented 1 year ago

Not sure what you mean, how would that be different from putting the token you got externally in librespot's cache file?

I don't know whether tokens from the web client are interchangeable with tokens used to authenticate over Mercury.

GiviMAD commented 1 year ago

Hi, thank you for the quick response. I already tried to put the auth_type to 3 , and put in the auth_data field my Spotify token in base64, also tried with the refresh token, without luck. So maybe you are right and the token is not valid, I didn't know about Mercury at all.

roderickvd commented 1 year ago

You think we can close this then?

GiviMAD commented 1 year ago

yes, ty!