hassio-addons / addon-spotify-connect

Spotify Connect - Home Assistant Community Add-ons
https://addons.community
MIT License
191 stars 56 forks source link

Addon fails to start with "Login failed with reason: Bad credentials" #267

Open Pomezny opened 3 months ago

Pomezny commented 3 months ago

Problem/Motivation

Addon fails to start, spotifyd crashes. Error "[2024-08-14T09:25:51Z ERROR librespot] Connection failed: Login failed with reason: Bad credentials" can be observed in the log.

Expected behavior

Start the addon

Actual behavior

Main process crashes.

Steps to reproduce

Add Spotify username and Spotify password to the config and try to run the addon

Proposed changes

This issue is filed only to let other users and maintainer know what is going on. Spotify recently disabled username/password access which librespot uses as an authentication method to for the API. Workaround might me removing credentials, but it was observed that device discovery might not work. Proper solution in this repository is probably not possible, since it relies on librespot and we need to wait for the librespot team to resolve this issue. There already is issue in their repository and its looks like they are already working on solution here https://github.com/librespot-org/librespot/issues/1308 When librespot comes up with the solution addon will probably need some changes and update to latest librespot

rakalex commented 3 months ago

same issue, after upgraded to the latest HA Os version.

[2024-08-14T12:29:18Z WARN librespot_core::apresolve] Ignoring blacklisted access point ap-gue1.spotify.com:443 [2024-08-14T12:29:18Z WARN librespot_core::apresolve] Ignoring blacklisted access point ap-gew4.spotify.com:80 [2024-08-14T12:29:18Z INFO librespot_core::session] Connecting to AP "ap-gew1.spotify.com:4070" [2024-08-14T12:29:18Z ERROR librespot] Connection failed: Login failed with reason: Bad credentials

tjorim commented 3 months ago

Spotify disabled the use of username/password last weekend. We can't do anything about it at the moment as we rely on librespot. I can't test right now but the issue should only be auth. If starting without a username/password, it should still be discovered on your local network.

rosicenko commented 3 months ago

Yep, same happened to Music Assistant but there it is already fixed.

Rolfvanderplas commented 3 months ago

Yep, same for me. Starting without username/password suceeded.

dtap001 commented 3 months ago

same here. please fix it

CountOlaf87 commented 3 months ago

I'm having the same issue here

mwarchulinski commented 2 months ago

Same here. I tried to change my password, add a new connection method to my spotify account and even reinstall the addon. I'm starting to dig around librespot now.

gungam commented 2 months ago

same here tried Music Assistant:

Yep, same happened to Music Assistant but there it is already fixed.

but I'm unable to figure out to use the local audio out of the pi... :-( It seems to support only streaming devices as chrome cast oder sonos...

ironcrafter54 commented 2 months ago

but I'm unable to figure out to use the local audio out of the pi... :-( It seems to support only streaming devices as chrome cast oder sonos...

FYI I have found the best way to get audio out of the pi, assuming you are running HA is to install the shairport sync addon using this repository https://github.com/v3rm0n/hassio yes it is unmaintained, but for now it still works well, then add airplay as a player in Music assistant and It should automatically discover the shairport sync addon.

PerSterin commented 2 months ago

Yep, same for me. Starting without username/password suceeded. Debug logs without username and password and with username and password below. Have reinstalled Add-on: Spotify Connect, and changed the password.

Logger: homeassistant.helpers.config_entry_oauth2_flow Source: helpers/config_entry_oauth2_flow.py:220 First occurred: 22:48:48 (54 occurrences) Last logged: 23:46:33 Token request for spotify_13898cf388a1449885aac2cc99cc4255 failed (invalid_grant): Refresh token revoked

Without username/password.

Add-on: Spotify Connect Play Spotify music on your Home Assistant device

Add-on version: 0.13.0 You are running the latest version of this add-on. System: Home Assistant OS 13.0 (amd64 / generic-x86-64) Home Assistant Core: 2024.8.3 Home Assistant Supervisor: 2024.08.0

s6-rc: info: service base-addon-banner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service base-addon-log-level: starting s6-rc: info: service fix-attrs successfully started Log level is set to DEBUG s6-rc: info: service base-addon-log-level successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service legacy-services: starting services-up: info: copying legacy longrun spotifyd (no readiness notification) [23:24:02] INFO: Starting the Spotify daemon... s6-rc: info: service legacy-services successfully started [2024-08-25T21:24:02Z INFO librespot] librespot 0.4.2 UNKNOWN (Built on 2024-01-06, Build ID: 8ZfE3H9w, Profile: release) [2024-08-25T21:24:02Z TRACE librespot] Command line argument(s): [2024-08-25T21:24:02Z TRACE librespot] bitrate "320" [2024-08-25T21:24:02Z TRACE librespot] name "Spotify" [2024-08-25T21:24:02Z TRACE librespot] disable-audio-cache [2024-08-25T21:24:02Z TRACE librespot] verbose [2024-08-25T21:24:02Z DEBUG librespot_discovery::server] Zeroconf server listening on 0.0.0.0:36319

With username/password.

Add-on: Spotify Connect Play Spotify music on your Home Assistant device

Add-on version: 0.13.0 You are running the latest version of this add-on. System: Home Assistant OS 13.0 (amd64 / generic-x86-64) Home Assistant Core: 2024.8.3 Home Assistant Supervisor: 2024.08.0

s6-rc: info: service base-addon-banner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service base-addon-log-level: starting s6-rc: info: service fix-attrs successfully started Log level is set to DEBUG s6-rc: info: service base-addon-log-level successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service legacy-services: starting services-up: info: copying legacy longrun spotifyd (no readiness notification) [23:29:49] INFO: Starting the Spotify daemon... s6-rc: info: service legacy-services successfully started [2024-08-25T21:29:49Z INFO librespot] librespot 0.4.2 UNKNOWN (Built on 2024-01-06, Build ID: 8ZfE3H9w, Profile: release) [2024-08-25T21:29:49Z TRACE librespot] Command line argument(s): [2024-08-25T21:29:49Z TRACE librespot] bitrate "320" [2024-08-25T21:29:49Z TRACE librespot] name "Spotify" [2024-08-25T21:29:49Z TRACE librespot] username "XXXXXXXX" [2024-08-25T21:29:49Z TRACE librespot] password "XXXXXXXX" [2024-08-25T21:29:49Z TRACE librespot] disable-audio-cache [2024-08-25T21:29:49Z TRACE librespot] verbose [2024-08-25T21:29:49Z DEBUG librespot_discovery::server] Zeroconf server listening on 0.0.0.0:40565 [2024-08-25T21:29:49Z WARN librespot_core::apresolve] Ignoring blacklisted access point ap-gew4.spotify.com:4070 [2024-08-25T21:29:49Z WARN librespot_core::apresolve] Ignoring blacklisted access point ap-gew4.spotify.com:443 [2024-08-25T21:29:49Z WARN librespot_core::apresolve] Ignoring blacklisted access point ap-gew4.spotify.com:80 [2024-08-25T21:29:49Z WARN librespot_core::apresolve] Ignoring blacklisted access point ap-gue1.spotify.com:4070 [2024-08-25T21:29:49Z INFO librespot_core::session] Connecting to AP "ap-gew1.spotify.com:443" [2024-08-25T21:29:50Z ERROR librespot] Connection failed: Login failed with reason: Bad credentials [23:29:50] WARNING: spotifyd crashed, halting add-on s6-rc: info: service legacy-services: stopping [23:29:50] INFO: spotifyd stoped, restarting... s6-rc: info: service legacy-services successfully stopped s6-rc: info: service legacy-cont-init: stopping s6-rc: info: service legacy-cont-init successfully stopped s6-rc: info: service fix-attrs: stopping s6-rc: info: service base-addon-log-level: stopping s6-rc: info: service fix-attrs successfully stopped s6-rc: info: service base-addon-log-level successfully stopped s6-rc: info: service base-addon-banner: stopping s6-rc: info: service base-addon-banner successfully stopped s6-rc: info: service s6rc-oneshot-runner: stopping s6-rc: info: service s6rc-oneshot-runner successfully stopped

Goodie01 commented 2 months ago

After removing my username/password (best done through the "Edit in YAML" option) it seems to work as expected. Maybe with a slow initial connection?

MaxValue commented 2 months ago

Meta Info for anyone following this:

brixharlem commented 2 months ago

Has anybody found a workaround yet? Spotify Connect works after removing username and password, but I always need another device (e.g. smartphone) to "authenticate" Home Assistant by handing over the speaker. After HA restart, it has to be repeated. Thank you!

robertjscooper commented 2 months ago

For referenece; librespot has now merged a PR for handling OAuth2.0 authentication.

fchaudhri02 commented 1 month ago

Is there any update on this? I was using this at my business to automatically play music locally on home assistant which was connected to an AV receiver. Eagerly waiting for this to be fixed.

brixharlem commented 1 month ago

@fchaudhri02 I finally bought an audiocast pro device. This fixed it for me and works much better than before.

fchaudhri02 commented 1 month ago

@fchaudhri02 I finally bought an audiocast pro device. This fixed it for me and works much better than before.

@brixharlem How are you using that with home assistant? Are you using Spotify or Spotify Plus integration?

I had purchased WiiM Mini to try. My theory was if I put WiiM and home assistant on the same network, I should see WiiM as a device on the Spotify integration and should be able to play to it. If that worked, all of my automation should work, but Spotify integration doesn't see the WiiM. However, I am able to play to WiiM from the phone app.

brixharlem commented 1 month ago

@fchaudhri02 I finally bought an audiocast pro device. This fixed it for me and works much better than before.

@brixharlem How are you using that with home assistant? Are you using Spotify or Spotify Plus integration?

I had purchased WiiM Mini to try. My theory was if I put WiiM and home assistant on the same network, I should see WiiM as a device on the Spotify integration and should be able to play to it. If that worked, all of my automation should work, but Spotify integration doesn't see the WiiM. However, I am able to play to WiiM from the phone app.

Both works fine. After connecting, the "source" is available and never disappeared. The device is running for a week.

fchaudhri02 commented 1 month ago

@fchaudhri02 I finally bought an audiocast pro device. This fixed it for me and works much better than before.

@brixharlem How are you using that with home assistant? Are you using Spotify or Spotify Plus integration? I had purchased WiiM Mini to try. My theory was if I put WiiM and home assistant on the same network, I should see WiiM as a device on the Spotify integration and should be able to play to it. If that worked, all of my automation should work, but Spotify integration doesn't see the WiiM. However, I am able to play to WiiM from the phone app.

Both works fine. After connecting, the "source" is available and never disappeared. The device is running for a week.

@brixharlem Would you be able to share the steps you took to get it working? I can't figure out what am I missing or doing wrong.

For me, the spotify integration doesn't see Audiocast pro device. However, the spotifyplus integration does see it, but it fails to play on it. It gives me an error about credentials.

brixharlem commented 1 month ago

@fchaudhri02 Have you initialized the Spotify connection to Audiocast once with your mobile? Is the device available in the Spotify app?

realGlorix commented 2 weeks ago

After removing my username/password (best done through the "Edit in YAML" option) it seems to work as expected. Maybe with a slow initial connection?

thank you so much.