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

Spotify music_service search fails - AuthTokenExpired #428

Closed
Zolmeister opened this issue Aug 30, 2016 · 19 comments

Comments

Projects
None yet
@Zolmeister
Copy link

commented Aug 30, 2016

Seems simple enough, am I doing something incorrectly?

from soco import SoCo
from soco.music_services import MusicService

device = SoCo("x.x.x.x")
service = MusicService('Spotify')
service.search(category='tracks', term='pinball')
Traceback (most recent call last):
  File "soco-0.11.1-py3.5.egg/soco/music_services/music_service.py", line 151, in call
  File "soco-0.11.1-py3.5.egg/soco/soap.py", line 310, in call
soco.soap.SoapFault: s:Client.AuthTokenExpired: AuthTokenExpired

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "sonos.py", line 10, in <module>
    service.search(category='tracks', term='pinball')
  File "soco-0.11.1-py3.5.egg/soco/music_services/music_service.py", line 715, in search
  File "soco-0.11.1-py3.5.egg/soco/music_services/music_service.py", line 182, in call
soco.exceptions.MusicServiceException: ('AuthTokenExpired', 's:Client.AuthTokenExpired')

And changing Spotify to Google Play Music

Traceback (most recent call last):
  File "sonos.py", line 10, in <module>
    service.search(category='tracks', term='pinball')
  File "soco-0.11.1-py3.5.egg/soco/music_services/music_service.py", line 715, in search
  File "soco-0.11.1-py3.5.egg/soco/music_services/music_service.py", line 146, in call
  File "soco-0.11.1-py3.5.egg/soco/music_services/music_service.py", line 111, in get_soap_header
  File "soco-0.11.1-py3.5.egg/soco/services.py", line 181, in _dispatcher
  File "soco-0.11.1-py3.5.egg/soco/services.py", line 408, in send_command
  File "soco-0.11.1-py3.5.egg/soco/services.py", line 469, in handle_upnp_error
soco.exceptions.SoCoUPnPException: UPnP Error 8009 received:  from x.x.x.x
@KennethNielsen

This comment has been minimized.

Copy link
Member

commented Sep 5, 2016

Hallo @Zolmeister and thanks for reporting this.

@lawrenceakka do you have any input on this?

@tfriedel

This comment has been minimized.

Copy link

commented Oct 3, 2016

I have the same problem. With SoundCloud too. TuneIn works though.

@jrathert

This comment has been minimized.

Copy link

commented Oct 29, 2016

Same problem here with any relevant call to a Spotify-service. E.g. I do
spotify = MusicService('Spotify')
spotify.search(category='tracks', term='pinball')
meta = spotify.get_media_uri("spotify:track:7HFaTkpIeG0pXINEm7EEG4")
and both calls (search, get_media_uri) fail with the error above.

Although a bit experienced with programming and using PyCharm, I am not able to fully understand that.

@KennethNielsen

This comment has been minimized.

Copy link
Member

commented Oct 29, 2016

Hi guys.

We are seeing a lot of this right now for a large number of music services. My guess (which or more or less specifically mentioned in the traceback of the errors) is that one of the ways Sonos does music service authentication has changed and tha basically all the music services that authenticate that way therefore fails.

If someone wants to help and is up for some internet searching, it is possible that there is already information about this in the Sonos community or with one of the other Sonos driver implementations.

@lawrenceakka

This comment has been minimized.

Copy link
Contributor

commented Nov 6, 2016

Yup - the authentication methods have changed. I'm on it!

@jandebeule

This comment has been minimized.

Copy link

commented Dec 20, 2016

@lawrenceakka : do you have any update on this issue?

@Hackerjoe

This comment has been minimized.

Copy link

commented Dec 22, 2016

@lawrenceakka Also have same issue. Any news?

@janbar janbar referenced this issue Jan 7, 2017

Closed

Spotify support #7

@cfrauenberger

This comment has been minimized.

Copy link

commented Jan 13, 2017

Exact same problem with Spotify - happy to help @lawrenceakka in terms of testing / researching etc.

Thanks for looking into it!

@HughMacdonald

This comment has been minimized.

Copy link

commented Feb 4, 2017

Just wanted to add a "me too" - just started playing with SoCo, and can't get it to search Spotify. Commenting to ensure I get a notification when there's an update from @lawrenceakka

@JochenPfeifferHD

This comment has been minimized.

Copy link

commented Mar 26, 2017

Hi it is the same for me. Any News on this?

@lawrenceakka

This comment has been minimized.

Copy link
Contributor

commented Mar 26, 2017

Time for an update - sorry for the long silence 😁

Sonos has changed the way in which music service account data can be accessed. It used to be possible to get the necessary info from the players, but it is now encrypted using AES-CBC. Although other third party Sonos controllers have worked out how to get round this and decrypt the info (see here for a discussion), I am not sure that it would be right for us to do so in an open source project (though I haven't decided yet).

BUT:

I have today managed to successfully register a python soco script with Google Play Music. The script requires user interaction (you have to go to a web page and input your Google Play credentials). It may therefore be possible to create a workaround where you run a registration script and then use the returned details to allow SoCo to use third party media services. I suppose the details will change from time to time so it might be necessary to run the registration script again.

Research continues ....

@relevitt

This comment has been minimized.

Copy link
Contributor

commented Mar 26, 2017

Thanks for update. I use Sonos to listen to Spotify (plus downloaded music) and the Spotify API for searches. The main drawback of the change is I can't access Spotify Radio via SoCo.

@ghcs27

This comment has been minimized.

Copy link
Member

commented Mar 27, 2017

Now that it's confirmed that this problem pertains to all music services, I'd suggest making one issue for all problems arising from the account data encryption, and closing all the individual issues (#433, #446, #451) since it's better to have all the information in one place.

@KennethNielsen

This comment has been minimized.

Copy link
Member

commented Mar 27, 2017

@ghcs27 it is not all music services. I have a few running that works just fine. As I understand it, it is restricted to those that use OAuth authentication (@lawrenceakka right?) , most significantly Google Play Music and Spotify.

I think a common issue is a good idea, but we should make sure to get the description right.

@jhaals

This comment has been minimized.

Copy link

commented Aug 10, 2017

Hi, any updates on this issue?

@jeantristan

This comment has been minimized.

Copy link

commented Sep 9, 2017

Got the same issue here too

@KennethNielsen

This comment has been minimized.

Copy link
Member

commented Sep 18, 2017

@ghcs27 I do however support the idea of making a meta issue. Do you want to formulate it.

I also think, that we should add something in large bold red letters to the github frontpage, which clearly states, that the issue with these services is due to Sonos changing the authentication method to something that open source projects cannot access and that if people want that to change, they should bug Sonos, not us. I think maybe I will do a PR for that.

@estwanick

This comment has been minimized.

Copy link

commented Jan 1, 2018

Experiencing the same issue when calling get_metadata() on Apple Music

@KennethNielsen

This comment has been minimized.

Copy link
Member

commented Jan 6, 2018

Closing this issue in favor of #557 to gather information in one place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.