[GH-ISSUE #64] Question about spotify_token #52

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

Originally created by @hecht0r on GitHub (Aug 16, 2024).
Original GitHub issue: https://github.com/devgianlu/go-librespot/issues/64

Hi,

while using go-librespot with zeroconf works like a charm i want to use stored credentials. With zeroconf i have to select go-librespot as device manually in my spotify client. After that it works perfectly.

I tried to get my access_token via

curl -X POST "https://accounts.spotify.com/api/token" \
     -H "Content-Type: application/x-www-form-urlencoded" \
     -d "grant_type=client_credentials&client_id=your-client-id&client_secret=your-client-secret"

and put it in my config.yml like this:

credentials:
  type: spotify_token
  spotify_token:
    username: xxxx@gmail.com     
    access_token:  %he acces_token i got%

After starting go-libresport i get error
FATA[0001] failed running with username and spotify token error="failed authenticating accesspoint with username and spotify token: failed authenticating: failed login: BadCredentials"

What am I doing wrong? Thank you for any help

Originally created by @hecht0r on GitHub (Aug 16, 2024). Original GitHub issue: https://github.com/devgianlu/go-librespot/issues/64 Hi, while using go-librespot with zeroconf works like a charm i want to use stored credentials. With zeroconf i have to select go-librespot as device manually in my spotify client. After that it works perfectly. I tried to get my access_token via ``` curl -X POST "https://accounts.spotify.com/api/token" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "grant_type=client_credentials&client_id=your-client-id&client_secret=your-client-secret" ``` and put it in my config.yml like this: ``` credentials: type: spotify_token spotify_token: username: xxxx@gmail.com access_token: %he acces_token i got% ``` After starting go-libresport i get error `FATA[0001] failed running with username and spotify token error="failed authenticating accesspoint with username and spotify token: failed authenticating: failed login: BadCredentials"` What am I doing wrong? Thank you for any help
kerem closed this issue 2026-02-28 14:24:58 +03:00
Author
Owner

@devgianlu commented on GitHub (Aug 16, 2024):

You need to request a token with the correct scopes, they are listed here:
github.com/devgianlu/go-librespot@b9bc8c87f1/session/session.go (L101-L126)

If that feats you, the interactive login mode is also available which will handle the OAuth2 flow for you.

<!-- gh-comment-id:2293503453 --> @devgianlu commented on GitHub (Aug 16, 2024): You need to request a token with the correct scopes, they are listed here: https://github.com/devgianlu/go-librespot/blob/b9bc8c87f1b63cdffb6977ecd879d11db3373a78/session/session.go#L101-L126 If that feats you, the `interactive` login mode is also available which will handle the OAuth2 flow for you.
Author
Owner

@hecht0r commented on GitHub (Aug 16, 2024):

Interactive unfortunately doesn't work.
FATA[0000] unknown credentials: interactive

config.yml looks like this:

device_name: go-librespot
credentials:
  type: interactive

i am using the latest prebuild executable go-librespot_linux_arm64.tar.gz

<!-- gh-comment-id:2293697230 --> @hecht0r commented on GitHub (Aug 16, 2024): Interactive unfortunately doesn't work. `FATA[0000] unknown credentials: interactive ` config.yml looks like this: ``` device_name: go-librespot credentials: type: interactive ``` i am using the latest prebuild executable go-librespot_linux_arm64.tar.gz
Author
Owner

@devgianlu commented on GitHub (Aug 16, 2024):

This feature has not been released yet, to test it you need to compile yourself or wait for the next release.

<!-- gh-comment-id:2293779402 --> @devgianlu commented on GitHub (Aug 16, 2024): This feature has not been released yet, to test it you need to compile yourself or wait for the next release.
Author
Owner

@ChristianRamseier commented on GitHub (Aug 21, 2024):

Looking forward to see the interactive feature released. It would be nice if the redirect url will be configurable (i.e. a hostname instead of 127.0.0.1).

<!-- gh-comment-id:2301438043 --> @ChristianRamseier commented on GitHub (Aug 21, 2024): Looking forward to see the interactive feature released. It would be nice if the redirect url will be configurable (i.e. a hostname instead of 127.0.0.1).
Author
Owner

@devgianlu commented on GitHub (Aug 21, 2024):

It would be nice if the redirect url will be configurable (i.e. a hostname instead of 127.0.0.1).

We are using the client ID used by Spotify in its official client, so I am guessing they have locked it down to 127.0.0.1.

<!-- gh-comment-id:2301747107 --> @devgianlu commented on GitHub (Aug 21, 2024): > It would be nice if the redirect url will be configurable (i.e. a hostname instead of 127.0.0.1). We are using the client ID used by Spotify in its official client, so I am guessing they have locked it down to 127.0.0.1.
Author
Owner

@ChristianRamseier commented on GitHub (Aug 21, 2024):

It would be nice if the redirect url will be configurable (i.e. a hostname instead of 127.0.0.1).

We are using the client ID used by Spotify in its official client, so I am guessing they have locked it down to 127.0.0.1.

Hmm, ok. If they indeed locked it down, it means the browser with the login window needs to run on the same host as librespot?

<!-- gh-comment-id:2302268622 --> @ChristianRamseier commented on GitHub (Aug 21, 2024): > > It would be nice if the redirect url will be configurable (i.e. a hostname instead of 127.0.0.1). > > > > We are using the client ID used by Spotify in its official client, so I am guessing they have locked it down to 127.0.0.1. Hmm, ok. If they indeed locked it down, it means the browser with the login window needs to run on the same host as librespot?
Author
Owner

@devgianlu commented on GitHub (Aug 21, 2024):

It would be nice if the redirect url will be configurable (i.e. a hostname instead of 127.0.0.1).

We are using the client ID used by Spotify in its official client, so I am guessing they have locked it down to 127.0.0.1.

Hmm, ok. If they indeed locked it down, it means the browser with the login window needs to run on the same host as librespot?

You can copy the login URL go-librespot gives you into your browser, complete the signin and when it redirects you to 127.0.0.1 you copy that and do curl "..." on the device where go-librespot runs. It is annoying, but you need to do it only once.

<!-- gh-comment-id:2302636971 --> @devgianlu commented on GitHub (Aug 21, 2024): > > > It would be nice if the redirect url will be configurable (i.e. a hostname instead of 127.0.0.1). > > > > > > We are using the client ID used by Spotify in its official client, so I am guessing they have locked it down to 127.0.0.1. > > Hmm, ok. If they indeed locked it down, it means the browser with the login window needs to run on the same host as librespot? You can copy the login URL go-librespot gives you into your browser, complete the signin and when it redirects you to 127.0.0.1 you copy that and do `curl "..."` on the device where go-librespot runs. It is annoying, but you need to do it only once.
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#52
No description provided.