[GH-ISSUE #25] Token caching #18

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

Originally created by @jsv93 on GitHub (Mar 18, 2024).
Original GitHub issue: https://github.com/devgianlu/go-librespot/issues/25

Is it possible to add token caching similare to how Raspotify works?
When the user is using username and password to login, this can also be used to retrieve an access token which can be cached. I am aware that the user can provide an access token themselves, but I figured as the user is already providing the information required to retrieve an access token it would be nice to have it included as a feature.

I have go-librespot operating in a portable device, however each time the device is used I recieve an email notifying of the "new login". Zero-config circumvents this issue but my application does not always allow zero-config to be used.

Thanks again for an creating and awesome build. It has been working well in my application!

Originally created by @jsv93 on GitHub (Mar 18, 2024). Original GitHub issue: https://github.com/devgianlu/go-librespot/issues/25 Is it possible to add token caching similare to how Raspotify works? When the user is using username and password to login, this can also be used to retrieve an access token which can be cached. I am aware that the user can provide an access token themselves, but I figured as the user is already providing the information required to retrieve an access token it would be nice to have it included as a feature. I have go-librespot operating in a portable device, however each time the device is used I recieve an email notifying of the "new login". Zero-config circumvents this issue but my application does not always allow zero-config to be used. Thanks again for an creating and awesome build. It has been working well in my application!
kerem closed this issue 2026-02-28 14:24:43 +03:00
Author
Owner

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

This is already supported, after logging in successfully go-librespot should create a file called credentials.json containing the stored credentials that can be reused across restarts.

If you enable debug logging you should see something about it.

<!-- gh-comment-id:2004841606 --> @devgianlu commented on GitHub (Mar 18, 2024): This is already supported, after logging in successfully `go-librespot` should create a file called `credentials.json` containing the stored credentials that can be reused across restarts. If you enable debug logging you should see something about it.
Author
Owner

@agneevX commented on GitHub (May 2, 2024):

@devgianlu after this file is created, how does one go about removing the plaintext credentials from config.yml?

<!-- gh-comment-id:2090127972 --> @agneevX commented on GitHub (May 2, 2024): @devgianlu after this file is created, how does one go about removing the plaintext credentials from `config.yml`?
Author
Owner

@devgianlu commented on GitHub (May 2, 2024):

@agneevX After the file has been created you can remove the password field, the username field must stay in the config file as a sanity check that the credentials are for the correct user.

<!-- gh-comment-id:2090137447 --> @devgianlu commented on GitHub (May 2, 2024): @agneevX After the file has been created you can remove the password field, the username field must stay in the config file as a sanity check that the credentials are for the correct user.
Author
Owner

@agneevX commented on GitHub (May 2, 2024):

Fair @devgianlu, but I get this error when I do that:

WARN[0000] stored credentials found for wrong username 3163ntztuis6rybst2jgnosqcmfy != <MY_EMAIL_ADDRESS>
FATA[0001] failed running with username and password     error="failed authenticating accesspoint with username and password: failed authenticating: failed login: BadCredentials"
<!-- gh-comment-id:2090143245 --> @agneevX commented on GitHub (May 2, 2024): Fair @devgianlu, but I get this error when I do that: ``` WARN[0000] stored credentials found for wrong username 3163ntztuis6rybst2jgnosqcmfy != <MY_EMAIL_ADDRESS> FATA[0001] failed running with username and password error="failed authenticating accesspoint with username and password: failed authenticating: failed login: BadCredentials" ```
Author
Owner

@devgianlu commented on GitHub (May 2, 2024):

@agneevX That probably happens because 3163ntztuis6rybst2jgnosqcmfy is your device credential username. Try using that as your username once the credentials file has been generated.

<!-- gh-comment-id:2090156573 --> @devgianlu commented on GitHub (May 2, 2024): @agneevX That probably happens because `3163ntztuis6rybst2jgnosqcmfy` is your device credential username. Try using that as your username once the credentials file has been generated.
Author
Owner

@agneevX commented on GitHub (May 2, 2024):

Thanks @devgianlu, that worked well. Is playback reporting a planned feature? Also it seems that initial volume steps feature is broken.

<!-- gh-comment-id:2090163404 --> @agneevX commented on GitHub (May 2, 2024): Thanks @devgianlu, that worked well. Is playback reporting a planned feature? Also it seems that initial volume steps feature is broken.
Author
Owner

@devgianlu commented on GitHub (May 2, 2024):

Is playback reporting a planned feature?

It is eventually. Unlucky it is a very delicate topic that also requires a good amount of work to get done.

Also it seems that initial volume steps feature is broken.

Please open another issue explaining the problem.

<!-- gh-comment-id:2090173766 --> @devgianlu commented on GitHub (May 2, 2024): > Is playback reporting a planned feature? It is _eventually_. Unlucky it is a very delicate topic that also requires a good amount of work to get done. > Also it seems that initial volume steps feature is broken. Please open another issue explaining the problem.
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#18
No description provided.