[GH-ISSUE #1436] Login failed #646

Closed
opened 2026-02-27 19:31:45 +03:00 by kerem · 2 comments
Owner

Originally created by @MrBuddyCasino on GitHub (Jan 8, 2025).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/1436

Description

Running examples/play.rs with a freshly created token gives an "Error connecting: Permission denied { Login failed with reason: Bad credentials }" message.

Version

0.6.0

How to reproduce

Run the example player with your token and some track ID.
A token can be obtained by making an example app in the developer portal and calling:

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-id>&client_secret=<your-secret>"

Log

Not sure how --verbose applies to the example player. Console says:

Connecting...
Error connecting: Permission denied { Login failed with reason: Bad credentials }

Host (what you are running librespot on):

  • OS: MacOS
  • Platform: Intel

Additional Information

I also tried if Credentials::with_password() instead of ::with_access_token() would work, but same error.

I also tried latest dev branch but I got "HostUnreachable, message: "No route to host"":

[2025-01-08T11:13:01Z INFO  librespot] librespot 0.6.0-dev 7003e98 (Built on 2025-01-08, Build ID: JQs4aKqk, Profile: debug)
[2025-01-08T11:13:01Z INFO  librespot_playback::mixer::softmixer] Mixing with softvol and volume control: Log(60.0)
[2025-01-08T11:13:01Z INFO  librespot_playback::convert] Converting with ditherer: tpdf
[2025-01-08T11:13:01Z INFO  librespot_playback::audio_backend::rodio] Using Rodio sink with format S16 and cpal host: CoreAudio
[2025-01-08T11:13:01Z WARN  libmdns::fsm] error sending packet Os { code: 65, kind: HostUnreachable, message: "No route to host" }
[2025-01-08T11:13:01Z INFO  librespot_playback::audio_backend::rodio] Using audio device: Built-in Output
^C[2025-01-08T11:13:52Z INFO  librespot] Gracefully shutting down
Originally created by @MrBuddyCasino on GitHub (Jan 8, 2025). Original GitHub issue: https://github.com/librespot-org/librespot/issues/1436 ### Description Running `examples/play.rs` with a freshly created token gives an "Error connecting: Permission denied { Login failed with reason: Bad credentials }" message. ### Version 0.6.0 ### How to reproduce Run the example player with your token and some track ID. A token can be obtained by making an example app in the developer portal and calling: ``` 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-id>&client_secret=<your-secret>" ``` ### Log Not sure how `--verbose` applies to the example player. Console says: ``` Connecting... Error connecting: Permission denied { Login failed with reason: Bad credentials } ``` ### Host (what you are running `librespot` on): - OS: MacOS - Platform: Intel ### Additional Information I also tried if `Credentials::with_password()` instead of `::with_access_token()` would work, but same error. I also tried latest `dev` branch but I got "HostUnreachable, message: "No route to host"": ``` [2025-01-08T11:13:01Z INFO librespot] librespot 0.6.0-dev 7003e98 (Built on 2025-01-08, Build ID: JQs4aKqk, Profile: debug) [2025-01-08T11:13:01Z INFO librespot_playback::mixer::softmixer] Mixing with softvol and volume control: Log(60.0) [2025-01-08T11:13:01Z INFO librespot_playback::convert] Converting with ditherer: tpdf [2025-01-08T11:13:01Z INFO librespot_playback::audio_backend::rodio] Using Rodio sink with format S16 and cpal host: CoreAudio [2025-01-08T11:13:01Z WARN libmdns::fsm] error sending packet Os { code: 65, kind: HostUnreachable, message: "No route to host" } [2025-01-08T11:13:01Z INFO librespot_playback::audio_backend::rodio] Using audio device: Built-in Output ^C[2025-01-08T11:13:52Z INFO librespot] Gracefully shutting down ```
kerem 2026-02-27 19:31:45 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@kingosticks commented on GitHub (Jan 8, 2025):

First up, I don't think we support the client credentials flow. I don't think it makes much sense for librespot. I've never tested it, I've no idea if it works. Good luck if that's really your intention/

If you just wanted to get a valid token then our access token documentation specifies some ways to obtain a valid token. If you chose the second way, then you'll need to use the auth code flow.

You can also get a token using https://github.com/librespot-org/librespot/blob/dev/examples/get_token.rs .

I can think of no reason the dev branch would give you a "No route to host" error, I would guess that's a problem in your network. There's also nothing in latest dev that should impact basic session login.

<!-- gh-comment-id:2577443966 --> @kingosticks commented on GitHub (Jan 8, 2025): First up, I don't think we support the [client credentials flow](https://developer.spotify.com/documentation/web-api/tutorials/client-credentials-flow). I don't think it makes much sense for librespot. I've never tested it, I've no idea if it works. Good luck if that's really your intention/ If you just wanted to get a valid token then our [access token documentation](https://github.com/librespot-org/librespot/wiki/Options#access-token) specifies some ways to obtain a valid token. If you chose the second way, then you'll need to use the [auth code flow](https://developer.spotify.com/documentation/web-api/tutorials/code-flow). You can also get a token using https://github.com/librespot-org/librespot/blob/dev/examples/get_token.rs . I can think of no reason the dev branch would give you a "No route to host" error, I would guess that's a problem in your network. There's also nothing in latest dev that should impact basic session login.
Author
Owner

@MrBuddyCasino commented on GitHub (Jan 8, 2025):

Thanks for the detailed reply, and sorry for wasting your time - I used the token from https://open.spotify.com/get_access_token and that did the trick. Feel free to close this!

<!-- gh-comment-id:2577506238 --> @MrBuddyCasino commented on GitHub (Jan 8, 2025): Thanks for the detailed reply, and sorry for wasting your time - I used the token from `https://open.spotify.com/get_access_token` and that did the trick. Feel free to close this!
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/librespot#646
No description provided.