music-assistant / hass-music-assistant

Turn your Home Assistant instance into a jukebox, hassle free streaming of your favorite media to Home Assistant media players.
Apache License 2.0
1.39k stars 51 forks source link

Spotify provider | Login failed since 2.1.3 #2754

Closed eekamouze closed 2 months ago

eekamouze commented 3 months ago

What version of Music Assistant has the issue?

2.1.3

What version of the Home Assistant Integration have you got installed?

n/a

Have you tried everything in the Troubleshooting FAQ and reviewed the Open and Closed Issues and Discussions to resolve this yourself?

The problem

I received a notification from spotify yesterday night telling me that my password has been reseted due to abnormal activity. After changing my password today I realized that I cannot login anymore within MASS spotify provider. I did the upgrade to 2.1.3 24h ago and I suspect the abnormal activity comes from MASS. I rolled back to a previous version (2.0.7) and that fixed the problem

How to reproduce

Upgrade to 2.1.3 (latest)

Music Providers

Spotify

Player Providers

n/a

Full log output

No response

Additional information

No response

What version of Home Assistant Core are your running

2024.8.1

What type of installation are you running?

Home Assistant Container

On what type of hardware are you running?

Raspberry Pi

CrallH commented 3 months ago

i have the same issue. Got the same mail from spotify and also changed passoword, and now i cant login in MA.

Rep-Hueman commented 3 months ago

i have the same issue

burghs commented 3 months ago

The issue is on Spotify side, looks like Username and Password for authentication is changing on their end. MASS beta6 release works with the new authentication method so I would imagine that the stable release will follow shortly.

Rep-Hueman commented 3 months ago

Better to use the login process as HA uses. Don't use username and password but a Spotify APP - Client ID with a Client secret

DanielHabenicht commented 3 months ago

This is a duplicate of https://github.com/music-assistant/hass-music-assistant/issues/2749

@OzGav I tried the beta6 and must say that the process is a little bit confusing for a normal user. Would it be possible to change the warning tab to a modal which opens on pressing the "Authenticate" button and than guides a user through authenticating instead?

marcelveldt commented 3 months ago

Better to use the login process as HA uses. Don't use username and password but a Spotify APP - Client ID with a Client secret

That is not entirely that simple as MA also needs to playback actual audio and HA can only control the regular web api.

We have indeed implemented a new auth method (using spotify connect) to replace the deprecated username/password login and testing it in beta. If reports from the beta today are fine, we'll bump stable as well to have this fix.

marcelveldt commented 3 months ago

This is a duplicate of #2749

@OzGav I tried the beta6 and must say that the process is a little bit confusing for a normal user. Would it be possible to change the warning tab to a modal which opens on pressing the "Authenticate" button and than guides a user through authenticating instead?

No not possible at the moment. Just read the text and you'll be fine.

DanielHabenicht commented 3 months ago

This is a duplicate of #2749 @OzGav I tried the beta6 and must say that the process is a little bit confusing for a normal user. Would it be possible to change the warning tab to a modal which opens on pressing the "Authenticate" button and than guides a user through authenticating instead?

No not possible at the moment. Just read the text and you'll be fine.

Alright, apart from that I can report that it works for me.

cornebistouille commented 3 months ago

i have the same problem with one my account (my wife's one that i shared with my premiuum account) i a new to this... some guys above talk about a solution, but i don't understand it...

mdepedrof commented 3 months ago

Same here. Premium spotify account and i cant login. I use docker with latest tag on image

erkr commented 3 months ago

Latest version fixed it for me. Please try server version 2.1.4 Please note: you just press authenticate in the Spotify provider, then open the official Spotify app and select music assistant for playback to complete

eamonnsullivan commented 3 months ago

I'm seeing the same issue and I am already using beta 6 of the server. I got the password-reset email, changed my password, but Music Assistant is just spinning and never shows me anything else when I try to reauthenticate there.

erkr commented 3 months ago

@eamonnsullivan did you open music assistant as playback destination on you Spotify app after pressing the authorize button on MA? That needs to be done once to complete authentication! After a successful logon, it will take some time to sync all data. Especially without an own client id

I successfully re-authored two Spotify accounts, with their own client id's

eekamouze commented 3 months ago

Worked for me after upgrading to 2.1.4 and selecting MUSIC_ASSISTANT as the playback device on my Spotify app. Also I managed to add Spotify Client ID. Thanks.

eamonnsullivan commented 3 months ago

@eamonnsullivan did you open music assistant as playback destination on you Spotify app after pressing the authorize button on MA? That needs to be done once to complete authentication! After a successful logon, it will take some time to sync all data. Especially without an own client id

I successfully re-authored two Spotify accounts, with their own client id's

Thanks. I'll have to wait until I'm home, then. I was trying to do this via my Home Assistant Cloud connection from the office, which obviously isn't going to work. Could this be documented better, maybe? It was not obvious. Maybe a modal that says "Hey, now go connect to 'Music Assistant' in your app..."

OzGav commented 3 months ago

Documentation amendments have been drafted. They are waiting review

OzGav commented 3 months ago

2.1.4 has been released

marcelveldt commented 3 months ago

Let's leave this one open for others to quickly spot it and close once the dust settles down.

firefrei commented 3 months ago

Does your Spotify App needs to be on the same L2 network than music assistant? If this is the case, probably this information also helps others (as I couldn't find it in the docs so far).

I'm running 2.1.4 and clicked the Authenticate Spotify button, but the wheel keeps spinning. In my Spotify app I do not see any Music_Assistant device (Well, how should the app find the MA instance if I do not/cannot enter anything like an ID :-)). Is there any other auth. option / enhancement planned for future release to support this, or do I need to move MA to my user wifi network 'just' for the auth. process (my MA instance is running behind a reverse proxy on my server, so it is not directly attached to any user network)?

Many thanks to the MA team for providing a fix in such a short time!

OzGav commented 3 months ago

Yes. You could put your device on the network MA is on instead.

And see three posts above yours.

diogotcorreia commented 3 months ago

@firefrei I had the same problem. I ended up downloading the librespot binary (https://github.com/music-assistant/server/blob/1d49e4061d50299195e195ff39e121423647a44c/music_assistant/server/providers/spotify/bin/librespot-linux-x86_64) and running it (see below) on my desktop (which is also running a Spotify official client). The device then showed up on my PC in the Spotify app. Then, copy the ./data-dir/credentials.json file to the spotify (or spotify-setup, whichever exists) directory in the MA data directory (/data on the container).

To run librespot use the command: ./librespot-linux-x86_64 -c ./data-dir -a -n MUSIC_ASSISTANT (you might need to create ./data-dir manually)

Note: you might need to reload the spotify provider after moving the file.

marcelveldt commented 3 months ago

Folks, just follow our documentation and make sure MA sits on the same L2 network as your devices (and Spotify app in this case) without firewalls so that hacks like this are not needed.

Intellium commented 3 months ago

Does your Spotify App needs to be on the same L2 network than music assistant? If this is the case, probably this information also helps others (as I couldn't find it in the docs so far).

I'm running 2.1.4 and clicked the Authenticate Spotify button, but the wheel keeps spinning. In my Spotify app I do not see any Music_Assistant device (Well, how should the app find the MA instance if I do not/cannot enter anything like an ID :-)). Is there any other auth. option / enhancement planned for future release to support this, or do I need to move MA to my user wifi network 'just' for the auth. process (my MA instance is running behind a reverse proxy on my server, so it is not directly attached to any user network)?

Many thanks to the MA team for providing a fix in such a short time!

I'm having the same issue. But even using the app in the same L2 as where music assistant is running, there is no Music_Assistant player. Even though I can see every other player.

Intellium commented 3 months ago

Folks, just follow our documentation and make sure MA sits on the same L2 network as your devices (and Spotify app in this case) without firewalls so that hacks like this are not needed.

Am I missing something? The docs here https://music-assistant.io/music-providers/spotify/ still mention loging in with username and password. Nothing is mentioned about the new authentication flow?

eamonnsullivan commented 3 months ago

Am I missing something?

No, it's still the old docs. However, there's PR pending. It's mentioned in a comment above.

Intellium commented 3 months ago

@firefrei I had the same problem. I ended up downloading the librespot binary (https://github.com/music-assistant/server/blob/1d49e4061d50299195e195ff39e121423647a44c/music_assistant/server/providers/spotify/bin/librespot-linux-x86_64) and running it (see below) on my desktop (which is also running a Spotify official client). The device then showed up on my PC in the Spotify app. Then, copy the ./data-dir/credentials.json file to the spotify (or spotify-setup, whichever exists) directory in the MA data directory (/data on the container).

To run librespot use the command: ./librespot-linux-x86_64 -c ./data-dir -a -n MUSIC_ASSISTANT (you might need to create ./data-dir manually)

Note: you might need to reload the spotify provider after moving the file.

I had to do the same thing to get it working again. My music assistant is running in k8s. Allthough there is a L2 network available in the pod (via multus) on which it should be able to reach everything, I'm thinking the authentication flow doesn't use the setting to override IP ?

robin-thoni commented 3 months ago

My music assistant is running in k8s

That's the reason I hate L2 discovery. I would also like to move to this kind of setup, but there's just too many things relying on L2...

Someguitarist commented 3 months ago

Sorry, looks like I commented on another issue that's basically the same problem(#2758), but it looks like I'm having the same thing. No music assistant device appears no matter what I do. It seems like the common thread is that for people running it in docker it doesn't appear as a device no matter what.

Can the people having issues confirm if you're running it as a docker-container instead of an HA addon?

I have confirmed that I'm in network mode host and running the container as privileged, however nothing I do across multiple devices on the same network shows a MUSIC ASSISTANT device.

Someguitarist commented 3 months ago

EDIT: Sorry, figured it out. Had to disable UFW! Doh. Then it popped right up, authenticated with Spotify, then re-enabled UFW. Rebooted and tested and it seems like it's working. Thanks!

marcelveldt commented 3 months ago

I have some good news. I managed to get librespot compatible with the PKCE oauth flow. This means that we (finally) can have a true oauth login flow for our Spotify provider and when we need to playback we can just use the retrieved token from that flow for librespot as well.

For anyone now struggling with authentication (because it relies on librespot) that will be fixed. I am going to release a beta now with these changes so people can give it a try.

marcelveldt commented 3 months ago

The new/final auth method for Spotify is available in 2.2.0 beta 8 - if this is confirmed working, it will also be included in the patch release 2.1.5 for the stable version

OzGav commented 3 months ago

This is working well

derekngibbs commented 3 months ago

I'm having the same issue. After upgrading to 2.2.0b9 Spotify quit working. I removed it and tried to add it back. I'm entering my client Id in and hit authenticate and it just spins. Any ideas? Running as an add on in Home Assistant

OzGav commented 3 months ago

@derekngibbs what version of the server did Spotify work for you? It sound like the pop up is being blocked. Have you tried a different browser?

derekngibbs commented 3 months ago

I was trying from my phone. I'll try from my laptop and report back

eamonnsullivan commented 3 months ago

It was all working well for me yesterday, but this morning I needed to reauthenticate again with Spotify. It's a bit of a pain because it's both mine and my wife's accounts. Is that normal?

OzGav commented 3 months ago

The need to re-authenticate is being looked at

eamonnsullivan commented 3 months ago

Well, on the plus side, I've now memorised my wife's Spotify login credentials with all of these reauthenticating!

If it makes a difference, we're on a family plan -- we have different logins, playlists, etc., but under the same account.

marcelveldt commented 3 months ago

The need to re-authenticate is being looked at

On b9 it should keep authenticated. If not, I'm out of options.

eamonnsullivan commented 3 months ago

I'm on b9, but I'll keep an eye on it. I've logged in today on both accounts. I'll see what happens tomorrow.

eamonnsullivan commented 3 months ago

I also see a lot of these, which might be the result of having gone through b7 and b8:

2024-08-18 13:50:34.443 WARNING (MainThread) [music_assistant.music.track] Unable to fetch artist details library://artist/1475 - artist not found in library: 1475
2024-08-18 13:50:34.446 WARNING (MainThread) [music_assistant.music.track] Unable to fetch artist details library://artist/1478 - artist not found in library: 1478
2024-08-18 13:50:34.455 WARNING (MainThread) [music_assistant.music.track] Unable to fetch artist details library://artist/1682 - artist not found in library: 1682
2024-08-18 13:50:34.460 WARNING (MainThread) [music_assistant.music.track] Unable to fetch artist details library://artist/1200 - artist not found in library: 1200

And also see:

2024-08-18 13:52:22.546 WARNING (MainThread) [music_assistant.music] Sync task for Spotify: eamonn.sullivan completed with errors
2024-08-18 13:52:24.548 WARNING (MainThread) [music_assistant.music] Sync task for Spotify: Theresa Sullivan completed with errors

I may have to bite the bullet and just reinstall.

marcelveldt commented 3 months ago

OK, reproduced the expiring token - it was actually a rather stupid typo. So... beta 10 coming up which keeps the token alive :-)

marcelveldt commented 3 months ago

I may have to bite the bullet and just reinstall.

There is no (more) need for a full reinstall - we have introduced a button to just wipe the library database and trigger a full rescan.

eamonnsullivan commented 3 months ago

There is no (more) need for a full reinstall - we have introduced a button to just wipe the library database and trigger a full rescan.

I might not need this, since b10 seems to be working for me. But for future reference, where is this button?

marcelveldt commented 3 months ago

There is no (more) need for a full reinstall - we have introduced a button to just wipe the library database and trigger a full rescan.

I might not need this, since b10 seems to be working for me. But for future reference, where is this button?

settings - core modules - music controller - advanced section

eamonnsullivan commented 3 months ago

b10 and the reset button all seems to work fine for me -- looking good!

orgebar commented 3 months ago

The wheel keeps spinning with no action forever in beta 10 for me still, when hitting the authenticate button. How to ENABLE the pop-ups within the Companion App in iOS? Ive searched trough everything and couldn't find an option nor can I remember having blocked pop ups anywhere. I see the same behaviour in different Browsers in iOS (iPhone, latest firmware, Safari + Aloha + Chrome)

OzGav commented 3 months ago

You need to ENABLE popups. Use a different browser.

orgebar commented 3 months ago

You need to ENABLE popups. Use a different browser.

That was a typo... of course I tried to enable. I tried it in three different browsers plus the app, so this doesnt answer my question.

OzGav commented 3 months ago

Then something else on your network or device is blocking the progress. Have you tried a different computer?