Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication failures #1308

Closed
dspearson opened this issue Jul 29, 2024 · 125 comments · Fixed by #1309
Closed

Authentication failures #1308

dspearson opened this issue Jul 29, 2024 · 125 comments · Fixed by #1309
Labels

Comments

@dspearson
Copy link

"ERROR librespot] Connection failed: Login failed with reason: Bad credentials"

Credentials are valid.

I assume Spotify has changed the login flow. This affects upstream projects using librespot also, looking at their buglists.

@kingosticks
Copy link
Contributor

It appears to be for some users only. It's still working for me right now. So reproducing it (to debug it) might not be so simple (yet).

@azel1
Copy link

azel1 commented Jul 29, 2024

The same code gives bad credentials error on my linux machine, but works everytime on Windows. Tried multiple accounts.

@quantverse
Copy link

Same problem on my Linux machine since today. Yesterday it was still working fine.

Ubuntu 22.04.

@roderickvd
Copy link
Member

For the record, which version of librespot? 0.4? dev? Those downstream packages use 0.4 I presume. Please try them both. I remember I made some changes on it to dev.

Re: @kingosticks would also not be the first time that something gets broken / changed on Spotify's end, only to have it restored the day or week after.

Anyway, having it work on one platform and not the other is fishy.

@eladyn
Copy link
Contributor

eladyn commented Jul 29, 2024

I tried 0.4.2, dev and one of the proposed login5 changes, but all of them are broken for me. (although reconsidering what currently seems to be broken, the login5 thing should indeed not have much effect)

@andrewCohn
Copy link

andrewCohn commented Jul 29, 2024

0.5.0-dev is also affected on Arch kernel version 6.9.7.

Immediately after posting this, I tried again, and it just worked? I'm not entirely sure what changed; my systemctl script hasn't changed, but after a number of auto-restarts, it came back authenticated? Very strange!

@Losses
Copy link

Losses commented Jul 30, 2024

Same issue here

ERROR librespot] could not initialize spirc: Permission denied { Login failed with reason: Bad credentials }

@Geral3
Copy link

Geral3 commented Jul 30, 2024

Same Here

2024-07-30T05:43:24.314571Z  WARN spotify_player::auth: Failed to authenticate: Login failed with reason: Bad credentials

@dspearson
Copy link
Author

FWIW, the original bug report was made against latest dev on a Debian system that previously was working fine, with no new packages installed since breaking. (I built from git initially to see if it was fixed upstream.)

Feel free to reach out if you need any assistance to debug the issue, I'd be happy to help.

@roderickvd
Copy link
Member

Given it's working on Windows, what if you change this line:

let os = match std::env::consts::OS {

To pretend that it's always Windows?

You may need to do the same here:

let platform = match std::env::consts::OS {

Then in dev there's a similar thing in the HTTP client, but when you're authenticating, that's not yet where you are in the code flow.

It's the only thing I can now think of why it would work on Windows but not on Linux.

@IVIanuu
Copy link

IVIanuu commented Jul 30, 2024

Same issue here.

@Losses
Copy link

Losses commented Jul 30, 2024

@roderickvd Quickly checked the solution, not working, sadly.

librespot_core::session] Connecting to A[2024-07-30T07:32:37Z ERROR librespot] could not initialize spirc: Permission denied { Login failed with reason: Bad credentials }

System: NixOS 24.05.20240727.8c50662 (Uakari) x86_64

@roderickvd
Copy link
Member

Reporters, please add the access point / servers you are connecting to:

  • what the logs say as server
  • the IP that your name server resolves it to

I'm reading that the issue is on Windows also, so let's try to triangulate what's happening.
Are officially supported devices from the past (like stereo receivers, old Sonos thingies, whatever) also having issues?

@ssamjh
Copy link

ssamjh commented Jul 30, 2024

Getting this in New Zealand, using librespot-java v1.6.3 on Windows 10.

Using USER_PASS auth.

2024-07-30 19:45:17,085 DEBUG TimeProvider:90 - Loaded time offset from NTP: 1115ms 2024-07-30 19:45:18,142 INFO ApResolver:99 - Loaded aps into pool: {accesspoint=[ap-gae2.spotify.com:4070, ap-gae2.spotify.com:443, ap-gae2.spotify.com:80, ap-guc3.spotify.com:4070, ap-gue1.spotify.com:443, ap-gew4.spotify.com:80], dealer=[gae2-dealer2.spotify.com:443, guc3-dealer2.spotify.com:443, gue1-dealer2.spotify.com:443, gew4-dealer2.spotify.com:443], spclient=[gae2-spclient.spotify.com:443, guc3-spclient.spotify.com:443, gue1-spclient.spotify.com:443, gew4-spclient.spotify.com:443]} 2024-07-30 19:45:18,359 INFO Session:140 - Created new session! {deviceId: <snip>, ap: ap-guc3.spotify.com:4070, proxy: false} 2024-07-30 19:45:19,194 INFO Session:334 - Connected successfully! 2024-07-30 19:45:19,647 ERROR Log4JUncaughtExceptionHandler:31 - [main] xyz.gianlu.librespot.core.Session$SpotifyAuthenticationException: BadCredentials at xyz.gianlu.librespot.core.Session.authenticatePartial(Session.java:453) ~[librespot-api-1.6.3.jar:1.6.3] at xyz.gianlu.librespot.core.Session.authenticate(Session.java:342) ~[librespot-api-1.6.3.jar:1.6.3] at xyz.gianlu.librespot.core.Session.access$600(Session.java:77) ~[librespot-api-1.6.3.jar:1.6.3] at xyz.gianlu.librespot.core.Session$Builder.create(Session.java:1057) ~[librespot-api-1.6.3.jar:1.6.3] at xyz.gianlu.librespot.api.Main.withPlayer(Main.java:53) ~[librespot-api-1.6.3.jar:1.6.3] at xyz.gianlu.librespot.api.Main.main(Main.java:45) ~[librespot-api-1.6.3.jar:1.6.3]

@Losses
Copy link

Losses commented Jul 30, 2024

@roderickvd

Server:

ap-gew1.spotify.com

Ping Result:

PING ap-gew1.spotify.com (104.199.65.124) 56(84) bytes of data.
64 bytes from 124.65.199.104.bc.googleusercontent.com (104.199.65.124): icmp_seq=1 ttl=52 time=278 ms

@noahhaon
Copy link

noahhaon commented Jul 30, 2024

From a raspberry pi 4 running LibreELEC:

# librespot --bitrate 320 --device-type tv --disable-audio-cache --disable-credential-cache --name Librespot@LibreELEC --onevent onevent.py --quiet -A on -u [REDACTED] -p [REDACTED]-O -v --backend pulseaudio --device librespot

[2024-07-30T08:08:36Z WARN  librespot] `--verbose` and `--quiet` are mutually exclusive. Logging can not be both verbose and quiet. Using verbose mode.
[2024-07-30T08:08:36Z INFO  librespot] librespot 0.5.0-dev 4513878 (Built on 2024-04-24, Build ID: YmZq6K14, Profile: release)
[2024-07-30T08:08:36Z TRACE librespot] Command line argument(s):
[2024-07-30T08:08:36Z TRACE librespot]          bitrate "320"
[2024-07-30T08:08:36Z TRACE librespot]          device-type "tv"
[2024-07-30T08:08:36Z TRACE librespot]          disable-audio-cache
[2024-07-30T08:08:36Z TRACE librespot]          disable-credential-cache
[2024-07-30T08:08:36Z TRACE librespot]          name "Librespot@LibreELEC"
[2024-07-30T08:08:36Z TRACE librespot]          onevent "onevent.py"
[2024-07-30T08:08:36Z TRACE librespot]          quiet
[2024-07-30T08:08:36Z TRACE librespot]          A "on"
[2024-07-30T08:08:36Z TRACE librespot]          u "XXXXXXXX"
[2024-07-30T08:08:36Z TRACE librespot]          p "XXXXXXXX"
[2024-07-30T08:08:36Z TRACE librespot]          O
[2024-07-30T08:08:36Z TRACE librespot]          v
[2024-07-30T08:08:36Z TRACE librespot]          backend "pulseaudio"
[2024-07-30T08:08:36Z TRACE librespot]          device "librespot"
[2024-07-30T08:08:36Z DEBUG librespot_core::session] new Session
[2024-07-30T08:08:36Z INFO  librespot_playback::mixer::softmixer] Mixing with softvol and volume control: Log(60.0)
[2024-07-30T08:08:36Z DEBUG librespot_playback::player] new Player [0]
[2024-07-30T08:08:36Z INFO  librespot_playback::convert] Converting with ditherer: tpdf
[2024-07-30T08:08:36Z INFO  librespot_playback::audio_backend::pulseaudio] Using PulseAudioSink with format: S16
[2024-07-30T08:08:36Z DEBUG librespot_connect::spirc] new Spirc[0]
[2024-07-30T08:08:36Z DEBUG librespot::component] new MercuryManager
[2024-07-30T08:08:36Z DEBUG librespot::component] new ApResolver
[2024-07-30T08:08:36Z DEBUG librespot_core::http_client] Requesting https://apresolve.spotify.com/?type=accesspoint&type=dealer&type=spclient
[2024-07-30T08:08:36Z DEBUG librespot_playback::player] command=AddEventSender
[2024-07-30T08:08:36Z INFO  librespot_core::session] Connecting to AP "ap-gew4.spotify.com:4070"
[2024-07-30T08:08:37Z ERROR librespot] could not initialize spirc: Permission denied { Login failed with reason: Bad credentials }

# nslookup ap-gew4.spotify.com
Server:    xxx
Address 1: xxx

Name:      ap-gew4.spotify.com
Address 1: 34.158.0.131 131.0.158.34.bc.googleusercontent.com

@erkr
Copy link

erkr commented Jul 30, 2024

It appears to be for some users only. It's still working for me right now.

Probably it happens once your token expires

@rgon
Copy link

rgon commented Jul 30, 2024

Using librespot-java and USER_PASS auth
ap: ap-gue1.spotify.com
Ping result:

PING ap-gew1.spotify.com (104.199.65.124) 56(84) bytes of data.
64 bytes from 124.65.199.104.bc.googleusercontent.com (104.199.65.124): icmp_seq=1 ttl=104 time=33.0 ms
Full log
spotifyd     | 2024-07-30 08:33:28,288 INFO  ApResolver:99 - Loaded aps into pool: {accesspoint=[ap-gew1.spotify.com:4070, ap-gew1.spotify.com:443, ap-gew1.spotify.com:80, ap-guc3.spotify.com:4070, ap-gue1.spotify.com:443, ap-gae2.spotify.com:80], dealer=[gew1-dealer2.spotify.com:443, guc3-dealer2.spotify.com:443, gue1-dealer2.spotify.com:443, gae2-dealer2.spotify.com:443], spclient=[gew1-spclient.spotify.com:443, guc3-spclient.spotify.com:443, gue1-spclient.spotify.com:443, gae2-spclient.spotify.com:443]}
spotifyd     | 2024-07-30 08:33:28,441 INFO  Session:140 - Created new session! {deviceId: , ap: ap-gue1.spotify.com:443, proxy: false} 
spotifyd     | 2024-07-30 08:33:29,092 INFO  Session:334 - Connected successfully!
spotifyd     | 2024-07-30 08:33:29,421 ERROR Log4JUncaughtExceptionHandler:31 - [main]
spotifyd     | xyz.gianlu.librespot.core.Session$SpotifyAuthenticationException: BadCredentials
spotifyd     | 	at xyz.gianlu.librespot.core.Session.authenticatePartial(Session.java:453) ~[librespot:1.6.3]
spotifyd     | 	at xyz.gianlu.librespot.core.Session.authenticate(Session.java:342) ~[librespot:1.6.3]
spotifyd     | 	at xyz.gianlu.librespot.core.Session.access$600(Session.java:77) ~[librespot:1.6.3]
spotifyd     | 	at xyz.gianlu.librespot.core.Session$Builder.create(Session.java:1057) ~[librespot:1.6.3]
spotifyd     | 	at xyz.gianlu.librespot.player.Main.main(Main.java:80) ~[librespot:1.6.3]
spotifyd     | 2024-07-30 08:34:30,706 INFO  ApResolver:99 - Loaded aps into pool: {accesspoint=[ap-gew1.spotify.com:4070, ap-gew1.spotify.com:443, ap-gew1.spotify.com:80, ap-guc3.spotify.com:4070, ap-gue1.spotify.com:443, ap-gew4.spotify.com:80], dealer=[gew1-dealer2.spotify.com:443, guc3-dealer2.spotify.com:443, gue1-dealer2.spotify.com:443, gew4-dealer2.spotify.com:443], spclient=[gew1-spclient.spotify.com:443, guc3-spclient.spotify.com:443, gue1-spclient.spotify.com:443, gew4-spclient.spotify.com:443]}
spotifyd     | 2024-07-30 08:34:30,759 INFO  Session:140 - Created new session! {deviceId: , ap: ap-gew1.spotify.com:443, proxy: false} 
spotifyd     | 2024-07-30 08:34:31,235 INFO  Session:334 - Connected successfully!
spotifyd     | 2024-07-30 08:34:31,429 ERROR Log4JUncaughtExceptionHandler:31 - [main]
spotifyd     | xyz.gianlu.librespot.core.Session$SpotifyAuthenticationException: BadCredentials
spotifyd     | 	at xyz.gianlu.librespot.core.Session.authenticatePartial(Session.java:453) ~[librespot:1.6.3]
spotifyd     | 	at xyz.gianlu.librespot.core.Session.authenticate(Session.java:342) ~[librespot:1.6.3]
spotifyd     | 	at xyz.gianlu.librespot.core.Session.access$600(Session.java:77) ~[librespot:1.6.3]
spotifyd     | 	at xyz.gianlu.librespot.core.Session$Builder.create(Session.java:1057) ~[librespot:1.6.3]
spotifyd     | 	at xyz.gianlu.librespot.player.Main.main(Main.java:80) ~[librespot:1.6.3]

@bitclick
Copy link

bitclick commented Jul 30, 2024

librespot 0.4.2 a6e1258 (Built on 2023-06-21, Build ID: AEkvVEBq, Profile: release)
Debian GNU/Linux 11

i am affected too, since 2024-07-29T09:37:23Z (in germany)
see attached logfile for connection attempts and servers (before and after the error started happening)
librespot-connection-attempts.log

  • sometimes it would succeed on a server that otherwise would fail
PING ap-guc3.spotify.com (104.154.127.126) 56(84) bytes of data.
64 bytes from 126.127.154.104.bc.googleusercontent.com (104.154.127.126): icmp_seq=1 ttl=56 time=125 ms

UPDATE:

  • workaround: on another host without credentials its working fine via zeroconf / lan discovery

@dspearson
Copy link
Author

Unfortunately changing the OS in the match clauses as suggested did nothing.

❯ ./target/debug/librespot --verbose  --username=XXXXXXXX --password=XXXXXXXX
[2024-07-30T08:47:26Z INFO  librespot] librespot 0.5.0-dev 299b7de (Built on 2024-07-30, Build ID: j5Xsh0Yw, Profile: debug)
[2024-07-30T08:47:26Z TRACE librespot] Command line argument(s):
[2024-07-30T08:47:26Z TRACE librespot]          verbose
[2024-07-30T08:47:26Z TRACE librespot]          username "XXXXXXXX"
[2024-07-30T08:47:26Z TRACE librespot]          password "XXXXXXXX"
[2024-07-30T08:47:26Z DEBUG librespot_core::session] new Session
[2024-07-30T08:47:26Z DEBUG librespot_discovery::server] Zeroconf server listening on 0.0.0.0:32987
[2024-07-30T08:47:26Z INFO  librespot_playback::mixer::softmixer] Mixing with softvol and volume control: Log(60.0)
[2024-07-30T08:47:26Z DEBUG librespot_connect::spirc] new Spirc[0]
[2024-07-30T08:47:26Z DEBUG librespot::component] new MercuryManager
[2024-07-30T08:47:26Z DEBUG librespot_playback::player] new Player [0]
[2024-07-30T08:47:26Z DEBUG librespot::component] new ApResolver
[2024-07-30T08:47:26Z INFO  librespot_playback::convert] Converting with ditherer: tpdf
[2024-07-30T08:47:26Z INFO  librespot_playback::audio_backend::rodio] Using Rodio sink with format S16 and cpal host: ALSA
[2024-07-30T08:47:26Z INFO  librespot_playback::audio_backend::rodio] Using audio device: default
[2024-07-30T08:47:26Z DEBUG librespot_core::http_client] Requesting https://apresolve.spotify.com/?type=accesspoint&type=dealer&type=spclient
[2024-07-30T08:47:26Z DEBUG librespot_playback::audio_backend::rodio] Rodio sink was created
[2024-07-30T08:47:26Z INFO  librespot_core::session] Connecting to AP "ap-gew4.spotify.com:4070"
[2024-07-30T08:47:26Z ERROR librespot] could not initialize spirc: Permission denied { Login failed with reason: Bad credentials }

❯ dig +short A ap-gew4.spotify.com
34.158.0.131

@BGazotti
Copy link

BGazotti commented Jul 30, 2024

Same here in São Paulo, Brazil, stopped working yesterday afternoon. 6.10.2 kernel on Gentoo.

$ librespot -u not-so-secret-username -p super-secret-password --enable-volume-normalisation --format F32 --normalisation-pregain=-5.5 --autoplay on --name librespot --bitrate 320 --device-type computer -v --backend pulseaudio 2>&1

[2024-07-30T08:55:43Z INFO  librespot] librespot 0.5.0-dev 299b7de (Built on 2024-07-29, Build ID: 9yMh5PUy, Profile: release)
[2024-07-30T08:55:43Z TRACE librespot] Command line argument(s):
[2024-07-30T08:55:43Z TRACE librespot] 		u "XXXXXXXX"
[2024-07-30T08:55:43Z TRACE librespot] 		p "XXXXXXXX"
[2024-07-30T08:55:43Z TRACE librespot] 		enable-volume-normalisation
[2024-07-30T08:55:43Z TRACE librespot] 		format "F32"
[2024-07-30T08:55:43Z TRACE librespot] 		normalisation-pregain "-5.5"
[2024-07-30T08:55:43Z TRACE librespot] 		autoplay "on"
[2024-07-30T08:55:43Z TRACE librespot] 		name "librespot"
[2024-07-30T08:55:43Z TRACE librespot] 		bitrate "320"
[2024-07-30T08:55:43Z TRACE librespot] 		device-type "computer"
[2024-07-30T08:55:43Z TRACE librespot] 		v
[2024-07-30T08:55:43Z TRACE librespot] 		backend "pulseaudio"
[2024-07-30T08:55:43Z DEBUG librespot_core::session] new Session
[2024-07-30T08:55:43Z DEBUG librespot_discovery::server] Zeroconf server listening on 0.0.0.0:38875
[2024-07-30T08:55:43Z INFO  librespot_playback::mixer::softmixer] Mixing with softvol and volume control: Log(60.0)
[2024-07-30T08:55:43Z DEBUG librespot_playback::player] Normalisation Type: Auto
[2024-07-30T08:55:43Z DEBUG librespot_playback::player] Normalisation Pregain: -5.5 dB
[2024-07-30T08:55:43Z DEBUG librespot_playback::player] Normalisation Threshold: -2.0 dBFS
[2024-07-30T08:55:43Z DEBUG librespot_playback::player] Normalisation Method: Dynamic
[2024-07-30T08:55:43Z DEBUG librespot_playback::player] Normalisation Attack: 5 ms
[2024-07-30T08:55:43Z DEBUG librespot_playback::player] Normalisation Release: 100 ms
[2024-07-30T08:55:43Z DEBUG librespot_playback::player] Normalisation Knee: 5 dB
[2024-07-30T08:55:43Z DEBUG librespot_connect::spirc] new Spirc[0]
[2024-07-30T08:55:43Z DEBUG librespot::component] new MercuryManager
[2024-07-30T08:55:43Z DEBUG librespot::component] new ApResolver
[2024-07-30T08:55:43Z DEBUG librespot_core::http_client] Requesting https://apresolve.spotify.com/?type=accesspoint&type=dealer&type=spclient
[2024-07-30T08:55:43Z DEBUG librespot_playback::player] new Player [0]
[2024-07-30T08:55:43Z INFO  librespot_playback::audio_backend::pulseaudio] Using PulseAudioSink with format: F32
[2024-07-30T08:55:43Z INFO  librespot_core::session] Connecting to AP "ap-gue1.spotify.com:4070"
[2024-07-30T08:55:44Z ERROR librespot] could not initialize spirc: Permission denied { Login failed with reason: Bad credentials }
<exit 1>

$ ping ap-gue1.spotify.com
PING ap-gue1.spotify.com (34.158.253.218) 56(84) bytes of data.
64 bytes from 218.253.158.34.bc.googleusercontent.com (34.158.253.218): icmp_seq=1 ttl=60 time=121 ms

@rgon
Copy link

rgon commented Jul 30, 2024

Do we have a way to block or force misbehaving APs? Given these logs, at least the following fail:

ap-gue1.spotify.com
ap-gew1.spotify.com
ap-gew4.spotify.com
ap-gae2.spotify.com

I tried the naive approach of pointing them to 127.0.0.1 in my /etc/hosts, but that triggers a connection error. Pointing them to another ap's IP also does not seem to do anything to avoid it.

@roderickvd
Copy link
Member

roderickvd commented Jul 30, 2024

Is it confirmed that other APs continue to work well?

It's not the first time that an AP starts misbehaving, but I don't remember this many. You could try pointing apresolve.spotify.com to 127.0.0.1 as it will force a fallback mechanism:

warn!("Failed to resolve all access points, using fallbacks");

If you want to filter APs then you could do it in the same file, probably here:

.filter_map(|ap| {

But filtering that many could result in an empty set... don't you only get like three or something?
So that should also make it resort to a fallback. No guarantees the fallback AP will work, although in the past it did.

Edit: misbehaving APs usually get fixed, sometimes in a few days, sometimes weeks. Not sure if this is a transitive failure on Spotify's end, or something that's really changing. That's why it would be good if someone had an old HW device with Connect to test, not something with recent firmware... to see if they're really phasing out this interface.

@noahhaon
Copy link

Maybe a stupid question, but how exactly do I authenticate with the credientals.json file?

Note that you have to disable zeroconf -O and use the -C parameter to point to the directory with the credentials.json file for it to be used.

@kingosticks
Copy link
Contributor

Just to be clear, you can generate credentials.json via zeroconf using normal librespot as is:

cargo run --no-default-features -- --cache SOME_DIRECTORY

You can then connect to that librespot instance from an official Spotify client, doing so will generate credentials.json in SOME_DIRECTORY which you can move elsewhere as required.

@andrewCohn
Copy link

Maybe a stupid question, but how exactly do I authenticate with the credientals.json file?

Note that you have to disable zeroconf -O and use the -C parameter to point to the directory with the credentials.json file for it to be used.

Strange, I did NOT use -O, as discovery was a feature I needed for this configuration, and it still worked fine. For what reason does discovery need to be disabled to use the credentials.json?

@noahhaon
Copy link

Maybe one of the developers can weigh in here, but for Spotify Connect, where via API or the app on another network you can control librespot, it needs to authenticate to the Spotify web API.

Zeroconf fetches those credentials from the spotify app running on another device, so you don't need cached credentials. For me it wouldn't use the cached credentials at all unless I disabled zeroconf. Note that I do not have the spotify app running on the same network as librespot and had to generate the cached credentials using the oauth2 flow from the fork posted earlier in this thread.

@kingosticks
Copy link
Contributor

If cached creds are present, they'll be used unless: a username and password is also specified, or just a username is specified and it is different to what's in the cached credentials.

Using cached credentials and having Zeroconf enabled are orthogonal.

@rwjack
Copy link

rwjack commented Aug 21, 2024

Anyone know how to pass the credentials.json file from @dspearson's tool to Snapcast/Librespot?

I'm already using the params field: https://github.com/badaix/snapcast/blob/develop/doc/configuration.md#available-parameters

echo -n "&params=--disable-discovery" >> "${config}"

But I'm not sure how to append -O and -C to it properly

Update: -O is disable discovery, so no need for that. -C is the cache dir, which can directly be passed to the Snapcast stream variable &cache=/data/librespot (Make sure to create the dir and store credentials.json there)

On another note, I'm having trouble running snapcast with the latest version of alpine... Just get a segfault... badaix/snapcast#1275

@roderickvd
Copy link
Member

We could ask them if username+password login via login5 (using Android client id and doing hashcash stuff) is going to continue to work beyond these "few days"?

I thought it was a good idea to find an opening for more collaboration before I starting shooting more detailed questions at them. This is what I just wrote them:

Dear Sir/Madam,

On behalf of the librespot team, thank you for giving us notice. We are migrating to an OAuth flow and hope to release it in short time.

Appreciating that you have reached out to us, how could we establish more contact?

Our goal remains to create a Spotify cross-platform streaming experience, increasing Spotify reach and presence, in full compatibility while standing against piracy.

On the compatibility front in particular we’re facing some challenges to understand your API, that could otherwise allow us to move to your new HTTP infrastructure entirely, amongst other things.

Thanks again - how do you think we could establish further contact?

Kind regards,

Roderick van Domburg
Librespot maintainer

I'll keep you informed if and how they respond.

@michaelherger
Copy link
Contributor

Thanks for your effort, @roderickvd. Unfortunately I happen to know that they have an issue with the lack of reporting (see #626). It's my vague memory that this was addressed in the Java version, but never made it to the Rust build? I could be wrong though, my memory is failing me way too often :(.

@roderickvd
Copy link
Member

Yes, librespot-java figured it out partially and it hasn't been back ported yet. Could be a good start for someone who wants to contribute - not super hard to send a message from the player to the session when a play finished, so the session can report it back to Spotify.

I remember that the librespot-java version didn't work under all circumstances, and doesn't have all fields figured out, so any clarification from Spotify would be welcome.

This is one of the things I thought of when I wrote "amongst other things" to Spotify - I'm all for artist monetisation but don't know if payout is high on Spotify's agenda. I am happy to hear from you that apparently it is, so if they could help us scratch that itch...

@fraintt
Copy link

fraintt commented Aug 25, 2024

Anyone know how to pass the credentials.json file from @dspearson's tool to Snapcast/Librespot?

I'm already using the params field: https://github.com/badaix/snapcast/blob/develop/doc/configuration.md#available-parameters

echo -n "&params=--disable-discovery" >> "${config}"

But I'm not sure how to append -O and -C to it properly

Update: -O is disable discovery, so no need for that. -C is the cache dir, which can directly be passed to the Snapcast stream variable &cache=/data/librespot (Make sure to create the dir and store credentials.json there)

On another note, I'm having trouble running snapcast with the latest version of alpine... Just get a segfault... badaix/snapcast#1275

So you basically mean create the credentials.json (with, lets say this ) and past the file in /data/librespot, and then in the snapserver.conf in the stream for spotify use this:

source = librespot:///librespot?name=Spotify&bitrate=160&devicename=SoundSystem&cache=/data/librespot

?

Thank you in advance!

@AdrieVanDijk
Copy link

I only removed the -u and -p parameters and it worked again, although it gave a warning:
Unable to get client token. Trying to continue without...
So why do I need a credentials.json ?

@DarpNagarsheth
Copy link

DarpNagarsheth commented Aug 31, 2024

Okay I'm able to get my cred json file but not login, might be newbie question but would love some help.
.
But I can see the way authentication is done now is changed, it was
.
{ "username": "",
"credentials": "",
"type": "AUTHENTICATION_STORED_SPOTIFY_CREDENTIALS" }
.
Now it is
.
{ "username": "",
"auth_type": 1,
"auth_data": "" }
.
how do I adapt my old login to this? I'm using zspotify https://www.reddit.com/r/Piracy/comments/15irsee/ive_updated_zspotifyexe_to_fix_its_bugs_from_the/
.

from librespot.core import Session
def login():
    """ Authenticates with Spotify and saves credentials to a file """
    global SESSION  # pylint: disable=global-statement

    if os.path.isfile("credentials.json"):
        try:
            SESSION = Session.Builder().stored_file().create()
            return
        except RuntimeError:
            pass
    while True:
        user_name = input("Username: ")
        password = input("Password: ")
        try:
            SESSION = Session.Builder().user_pass(user_name, password).create()
            return
        except RuntimeError:
            pass

.
Do I update librespot.core? because that's what's doing the auth?

@SuisChan
Copy link
Contributor

needs to be made in less than 10 seconds

Login challenge (hashcash)? It has always been like that

@3052
Copy link

3052 commented Sep 1, 2024

OK I have a working email/password implementation, again it was just the addition of the user-agent basically:

https://github.com/3052/platform/tree/v1.4.9/spotify

@xdfwers
Copy link

xdfwers commented Sep 10, 2024

@DarpNagarsheth Have you solved the issue, i am facing the same issue using zspotify.

@kingosticks
Copy link
Contributor

@DarpNagarsheth Have you solved the issue, i am facing the same issue using zspotify.

There is no support for that tool here. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.