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

Get 'Invalid Partner Login' With Valid Credentials #41

Closed
kdbdallas opened this issue Jan 7, 2016 · 30 comments
Closed

Get 'Invalid Partner Login' With Valid Credentials #41

kdbdallas opened this issue Jan 7, 2016 · 30 comments

Comments

@kdbdallas
Copy link

I have a Pandora One account (so I am actually paying Pandora monthly) and I am trying to setup mopidy-pandora to use my account, but no matter what I do I always get back 'Invalid Partner Login' and the extension ends up getting disabled.

The full error dump is:

ERROR    2016-01-06 21:30:41,991 [1601:PandoraBackend-7] pykka
  Unhandled exception in PandoraBackend (urn:uuid:931919b5-b51a-47ad-8462-fddb201d966a):
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pykka/actor.py", line 192, in _actor_loop
    self.on_start()
  File "/usr/local/lib/python2.7/dist-packages/mopidy_pandora/backend.py", line 52, in on_start
    self.api.login(self._config["username"], self._config["password"])
  File "/usr/local/lib/python2.7/dist-packages/pandora/client.py", line 71, in login
    return self._authenticate()
  File "/usr/local/lib/python2.7/dist-packages/pandora/client.py", line 85, in _authenticate
    xplatformAdCapable=True)
  File "/usr/local/lib/python2.7/dist-packages/pandora/transport.py", line 47, in function
    return func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pandora/transport.py", line 234, in __call__
    return self._parse_response(result)
  File "/usr/local/lib/python2.7/dist-packages/pandora/transport.py", line 220, in _parse_response
    raise PandoraException.from_code(result["code"], result["message"])
InvalidPartnerLogin: Invalid Partner Login
ERROR    2016-01-06 21:30:42,024 [1601:MainThread] mopidy.commands
  Actor died: PandoraBackend (urn:uuid:931919b5-b51a-47ad-8462-fddb201d966a) stopped before handling the message

My config is as follows:

[pandora]
enabled = true
api_host = tuner.pandora.com/services/json/
partner_encryption_key = 721^26xE22776
partner_decryption_key = 20zE1E47BE57$51
partner_username = iphone
partner_password = P2E4FC0EAD3*878N92B2CDp34I0B1@388137C
partner_device = IP01
preferred_audio_quality = mediumQuality #highQuality
username = myusername
password = mypassword
sort_order = date
auto_setup = true
### EXPERIMENTAL EVENT HANDLING IMPLEMENTATION ###
#event_support_enabled = false
#double_click_interval = 2.00
#on_pause_resume_click = thumbs_up
#on_pause_next_click = thumbs_down
#on_pause_previous_click = sleep

I got the Partner encrypt/decrypt/username/password/device from the link provided in the setup details.

@rectalogic
Copy link
Contributor

Maybe try another set of partner credentials, this set says it requires Pandora One so may work better for you: https://6xq.net/pandora-apidoc/json/partners/#internal-tuner-pandora-com

@kdbdallas
Copy link
Author

I had thought the same thing before and had tried several different ones with no luck.
I just tried that one again and same thing, 'Invalid Partner Login'.
I have validated my username and password. I just logged in to Pandora to make sure they were both still working.

@jcass77
Copy link
Member

jcass77 commented Jan 7, 2016

The api_host key doesn't look correct. For Pandora One accounts it should be something like internal-tuner.pandora.com/services/json/.

I'll update the README page to highlight this fact in the next release.

@kdbdallas
Copy link
Author

I just tried going back to the original values but using internal-tuner for api_host and still get the same thing.

@jcass77
Copy link
Member

jcass77 commented Jan 7, 2016

Could you perhaps confirm which versions of Mopidy-Pandora and pydora you are using?

@jcass77
Copy link
Member

jcass77 commented Jan 7, 2016

...as well as the version of 'certifi' that is installed.

@kdbdallas
Copy link
Author

According to pip freeze I have:
Mopidy-Pandora==0.1.7

I don't have 'certifi' installed, but it's not listed as a dependency of mopidy-pandora, is it?

@jcass77
Copy link
Member

jcass77 commented Jan 7, 2016

'certifi' is required by 'tornado', which is a dependency of Mopidy's - so it should be there if you installed Mopidy using pip.

As far as I understand certifi is required to make HTTPS requests (Mopidy won't even start up for me without it?).

@kdbdallas
Copy link
Author

Odd Mopidy works fine for me without... I will install it and see if that makes any difference.

@kdbdallas
Copy link
Author

Same thing even after installing 'certifi'.
However if I change the api_host back to the non-internal one I now get:

ERROR 2016-01-07 15:57:14,285 [1608:PandoraBackend-7] mopidy_pandora.uri
Error logging in to Pandora: ("bad handshake: Error([('SSL routines', 'SSL3_GET_SERVER_CERTIFICATE', 'certificate verify failed')],)",)

@jcass77
Copy link
Member

jcass77 commented Jan 7, 2016

I saw this with some of the certifi versions, but haven't looked into it in detail because I was not sure if it was unique to my setup.

Please try this specific version: pip install certifi==2015.4.28

@jcass77
Copy link
Member

jcass77 commented Jan 7, 2016

I would also try running pydora outside of Mopidy to help isolate the problem. Have a look at the installation instructions over at the pydora project site.

pydora-configure is a neat little utility that will help you create the necessary configuration file in ~/.pydora.cfg, and running pydora from the command line will give you a quick indication of whether the issues are Mopidy-related or not.

You could also try creating a free ad-supported account at www.pandora.com for testing - just to make doubly sure that the problem is not related to an issue with the Pandora user account somehow.

@kdbdallas
Copy link
Author

No luck with certifi==2015.4.28
With the non-internal one I don't get the SSL error but instead the same Invalid Partner Login error, however it looks a little different in some of the output. (its below)

ERROR    2016-01-07 16:36:43,620 [1704:PandoraBackend-7] pykka
  Unhandled exception in PandoraBackend (urn:uuid:f7984171-0553-43fc-9d6c-35ab8bac3f77):
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pykka/actor.py", line 192, in _actor_loop
    self.on_start()
  File "/usr/local/lib/python2.7/dist-packages/mopidy_pandora/backend.py", line 52, in on_start
    self.api.login(self._config["username"], self._config["password"])
  File "/usr/local/lib/python2.7/dist-packages/pandora/client.py", line 71, in login
    return self._authenticate()
  File "/usr/local/lib/python2.7/dist-packages/pandora/client.py", line 85, in _authenticate
    xplatformAdCapable=True)
  File "/usr/local/lib/python2.7/dist-packages/pandora/transport.py", line 47, in function
    return func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pandora/transport.py", line 234, in __call__
    return self._parse_response(result)
  File "/usr/local/lib/python2.7/dist-packages/pandora/transport.py", line 220, in _parse_response
    raise PandoraException.from_code(result["code"], result["message"])
InvalidPartnerLogin: Invalid Partner Login
ERROR    2016-01-07 16:36:43,672 [1704:MainThread] mopidy.commands
  Actor died: PandoraBackend (urn:uuid:f7984171-0553-43fc-9d6c-35ab8bac3f77) stopped before handling the message

The 'internal' url also gives me the 'Invalid Partner Login'.
So at least I am not getting the SSL error now.

I will try the other things you mention.

Thanks for the help!

@jcass77
Copy link
Member

jcass77 commented Jan 8, 2016

Assuming you are using pydora 1.6.4, it looks like auth.partnerLogin succeeds, and the failure is on auth.userLogin (line 85 of _pandora.client.authenticate).

This would indicate a problem with the user account, rather than the actual partner credentials.

It's a little misleading as they both result in an Invalid Partner Login error message, which is perhaps something that we can try to improve.

@kdbdallas
Copy link
Author

So I no longer get any errors! YAY! However, I don't see anything when I pull up the web client I can't find anything to do with Pandora.
I would figure it would be under either Playlists from the stuff listed in the README, but I have also checked under like Browse, etc.

@jcass77
Copy link
Member

jcass77 commented Jan 8, 2016

If you do not see 'Pandora' in the Mopidy library it means that the Mopidy-Pandora extension did not load successfully.

There should be some indication of the root cause in the log.

For the configuration that you posted; the comment at the end of preferred_audio_quality = mediumQuality #highQuality will likely produce a parsing error.

@kdbdallas
Copy link
Author

That was a problem and I fixed that.
Now the logs are clean.

It shows 'pandora' in the list of 'Enabled extensions' and the list of Disabled extensions is 'none'.

I even see:
2016-01-07 22:33:09,203 INFO [509:PandoraBackend-8] requests.packages.urllib3.connectionpool: Starting new HTTPS connection (1): tuner.pandora.com

But this is what I see in my UI:

screen shot 2016-01-07 at 11 13 22 pm
screen shot 2016-01-07 at 11 13 29 pm

@jcass77
Copy link
Member

jcass77 commented Jan 8, 2016

That's new. Could you perhaps run mopidy with --save-debug-log and post the log please?

Also include the output of pip list.

@jcass77
Copy link
Member

jcass77 commented Jan 8, 2016

Please also confirm that you get a listing of your Pandora stations if you just run pydora from the command line?

@kdbdallas
Copy link
Author

Here is the debug log:

INFO     2016-01-07 23:39:37,332 [5347:MainThread] mopidy.__main__
  Starting Mopidy 1.1.1
DEBUG    2016-01-07 23:39:37,409 [5347:MainThread] mopidy.ext
  Loading entry point: musicbox_webclient = mopidy_musicbox_webclient:MusicBoxExtension
DEBUG    2016-01-07 23:39:37,422 [5347:MainThread] mopidy.ext
  Loaded extension: Mopidy-MusicBox-Webclient 2.0.0
DEBUG    2016-01-07 23:39:37,532 [5347:MainThread] mopidy.ext
  Loading entry point: mpd = mopidy.mpd:Extension
DEBUG    2016-01-07 23:39:37,540 [5347:MainThread] mopidy.ext
  Loaded extension: Mopidy-MPD 1.1.1
DEBUG    2016-01-07 23:39:37,541 [5347:MainThread] mopidy.ext
  Loading entry point: http = mopidy.http:Extension
DEBUG    2016-01-07 23:39:37,550 [5347:MainThread] mopidy.ext
  Loaded extension: Mopidy-HTTP 1.1.1
DEBUG    2016-01-07 23:39:37,551 [5347:MainThread] mopidy.ext
  Loading entry point: stream = mopidy.stream:Extension
DEBUG    2016-01-07 23:39:37,559 [5347:MainThread] mopidy.ext
  Loaded extension: Mopidy-Stream 1.1.1
DEBUG    2016-01-07 23:39:37,560 [5347:MainThread] mopidy.ext
  Loading entry point: m3u = mopidy.m3u:Extension
DEBUG    2016-01-07 23:39:37,567 [5347:MainThread] mopidy.ext
  Loaded extension: Mopidy-M3U 1.1.1
DEBUG    2016-01-07 23:39:37,569 [5347:MainThread] mopidy.ext
  Loading entry point: softwaremixer = mopidy.softwaremixer:Extension
DEBUG    2016-01-07 23:39:37,575 [5347:MainThread] mopidy.ext
  Loaded extension: Mopidy-SoftwareMixer 1.1.1
DEBUG    2016-01-07 23:39:37,576 [5347:MainThread] mopidy.ext
  Loading entry point: file = mopidy.file:Extension
DEBUG    2016-01-07 23:39:37,584 [5347:MainThread] mopidy.ext
  Loaded extension: Mopidy-File 1.1.1
DEBUG    2016-01-07 23:39:37,585 [5347:MainThread] mopidy.ext
  Loading entry point: local = mopidy.local:Extension
DEBUG    2016-01-07 23:39:37,633 [5347:MainThread] mopidy.ext
  Loaded extension: Mopidy-Local 1.1.1
DEBUG    2016-01-07 23:39:37,652 [5347:MainThread] mopidy.ext
  Loading entry point: pandora = mopidy_pandora:Extension
DEBUG    2016-01-07 23:39:38,643 [5347:MainThread] mopidy.ext
  Loaded extension: Mopidy-Pandora 0.1.7
DEBUG    2016-01-07 23:39:38,650 [5347:MainThread] mopidy.ext
  Loading entry point: podcast = mopidy_podcast:Extension
DEBUG    2016-01-07 23:39:38,661 [5347:MainThread] mopidy.ext
  Loaded extension: Mopidy-Podcast 1.1.2
DEBUG    2016-01-07 23:39:38,669 [5347:MainThread] mopidy.ext
  Loading entry point: alsamixer = mopidy_alsamixer:Extension
DEBUG    2016-01-07 23:39:38,679 [5347:MainThread] mopidy.ext
  Loaded extension: Mopidy-ALSAMixer 1.0.3
DEBUG    2016-01-07 23:39:38,685 [5347:MainThread] mopidy.ext
  Loading entry point: local-sqlite = mopidy_local_sqlite:Extension
DEBUG    2016-01-07 23:39:38,697 [5347:MainThread] mopidy.ext
  Loaded extension: Mopidy-Local-SQLite 1.0.0
DEBUG    2016-01-07 23:39:38,706 [5347:MainThread] mopidy.ext
  Loading entry point: youtube = mopidy_youtube:Extension
DEBUG    2016-01-07 23:39:38,717 [5347:MainThread] mopidy.ext
  Loaded extension: Mopidy-YouTube 2.0.1
DEBUG    2016-01-07 23:39:38,731 [5347:MainThread] mopidy.ext
  Loading entry point: podcast-itunes = mopidy_podcast_itunes:Extension
DEBUG    2016-01-07 23:39:38,745 [5347:MainThread] mopidy.ext
  Loaded extension: Mopidy-Podcast-iTunes 1.0.0
DEBUG    2016-01-07 23:39:38,766 [5347:MainThread] mopidy.ext
  Loading entry point: scrobbler = mopidy_scrobbler:Extension
DEBUG    2016-01-07 23:39:38,776 [5347:MainThread] mopidy.ext
  Loaded extension: Mopidy-Scrobbler 1.1.1
DEBUG    2016-01-07 23:39:38,784 [5347:MainThread] mopidy.ext
  Discovered extensions: musicbox_webclient, mpd, http, stream, m3u, softwaremixer, file, local, pandora, podcast, alsamixer, local-sqlite, youtube, podcast-itunes, scrobbler
DEBUG    2016-01-07 23:39:38,858 [5347:MainThread] mopidy.config.keyring
  Fetching passwords from your keyring failed. Any passwords stored in the keyring will not be available. (dbus not installed)
INFO     2016-01-07 23:39:38,861 [5347:MainThread] mopidy.config
  Loading config from builtin defaults
INFO     2016-01-07 23:39:38,986 [5347:MainThread] mopidy.config
  Loading config from /etc/mopidy/mopidy.conf
INFO     2016-01-07 23:39:39,071 [5347:MainThread] mopidy.config
  Loading config from command line options
DEBUG    2016-01-07 23:39:39,140 [5347:MainThread] mopidy.config
  Ignoring unknown config section: moped
DEBUG    2016-01-07 23:39:39,367 [5347:MainThread] mopidy.ext
  Validating extension: musicbox_webclient
DEBUG    2016-01-07 23:39:39,398 [5347:MainThread] mopidy.ext
  Validating extension: mpd
DEBUG    2016-01-07 23:39:39,407 [5347:MainThread] mopidy.ext
  Validating extension: http
DEBUG    2016-01-07 23:39:40,096 [5347:MainThread] mopidy.ext
  Validating extension: stream
DEBUG    2016-01-07 23:39:40,106 [5347:MainThread] mopidy.ext
  Validating extension: m3u
DEBUG    2016-01-07 23:39:40,115 [5347:MainThread] mopidy.ext
  Validating extension: softwaremixer
DEBUG    2016-01-07 23:39:40,124 [5347:MainThread] mopidy.ext
  Validating extension: file
DEBUG    2016-01-07 23:39:40,134 [5347:MainThread] mopidy.ext
  Validating extension: local
DEBUG    2016-01-07 23:39:40,143 [5347:MainThread] mopidy.ext
  Validating extension: pandora
DEBUG    2016-01-07 23:39:40,210 [5347:MainThread] mopidy.ext
  Validating extension: podcast
DEBUG    2016-01-07 23:39:40,318 [5347:MainThread] mopidy.ext
  Validating extension: alsamixer
DEBUG    2016-01-07 23:39:40,365 [5347:MainThread] mopidy.ext
  Validating extension: local-sqlite
DEBUG    2016-01-07 23:39:40,406 [5347:MainThread] mopidy.ext
  Validating extension: youtube
DEBUG    2016-01-07 23:39:40,496 [5347:MainThread] mopidy.ext
  Validating extension: podcast-itunes
DEBUG    2016-01-07 23:39:40,526 [5347:MainThread] mopidy.ext
  Validating extension: scrobbler
INFO     2016-01-07 23:39:40,581 [5347:MainThread] mopidy.__main__
  Enabled extensions: mpd, alsamixer, http, pandora, stream, m3u, youtube, podcast-itunes, scrobbler, softwaremixer, file, musicbox_webclient, podcast, local, local-sqlite
INFO     2016-01-07 23:39:40,594 [5347:MainThread] mopidy.__main__
  Disabled extensions: none

pip list

cachetools (1.1.5)
certifi (2015.4.28)
chardet (2.3.0)
colorama (0.3.2)
configobj (5.0.6)
html5lib (0.999)
ipaddress (1.0.15)
itsdangerous (0.24)
Jinja2 (2.8)
MarkupSafe (0.23)
Mopidy (1.1.1)
Mopidy-ALSAMixer (1.0.3)
Mopidy-Local-SQLite (1.0.0)
Mopidy-MusicBox-Webclient (2.0.0)
Mopidy-Pandora (0.1.7)
Mopidy-Podcast (1.1.2)
Mopidy-Podcast-iTunes (1.0.0)
Mopidy-Scrobbler (1.1.1)
Mopidy-Youtube (2.0.1)
MySQL-python (1.2.3)
ndg-httpsclient (0.3.2)
pafy (0.4.2)
pbkdf2 (1.3)
pip (7.1.2)
pyalsaaudio (0.8.2)
pyasn1 (0.1.7)
pycrypto (2.6.1)
pycurl (7.19.5)
pydora (1.6.2)
pygobject (3.14.0)
Pykka (1.2.1)
pylast (1.5.1)
pyOpenSSL (0.13.1)
python-mpd2 (0.5.4)
requests (2.8.1)
RPi.GPIO (0.6.0a3)
setuptools (5.5.1)
six (1.8.0)
tornado (3.2.2)
uritools (1.0.1)
urllib3 (1.9.1)
websocket-client (0.34.0)
Werkzeug (0.11.2)
wheel (0.24.0)
wifi (0.3.4)
youtube-dl (2015.12.13)

Running 'pydora' from the command line works fine.
I get the list of stations and music plays great.

@jcass77
Copy link
Member

jcass77 commented Jan 8, 2016

I'm fresh out of ideas. Mopidy should be logging any further issues in communicating with the Pandora server, so if the logs are clean there really is no reason I can think of why an entry for Pandora should not be showing up in the library.

If you've got access to the source code you could try commenting out the implementation of mopidy_pandora.backend.PandoraBackend.on_start() - this is the only thing that the backend extension does between loading and rendering on screen. So if that works then there is still some sort of SSL connection issue lurking somewhere which is somehow managing to avoid detection (!?).

@kdbdallas
Copy link
Author

I installed via pip but I am more then happy to try uninstalling and doing an install via source.

Once I download the source from github should I just do a: python setup.py develop ?

@jcass77
Copy link
Member

jcass77 commented Jan 8, 2016

Yes please.

@kdbdallas
Copy link
Author

Commenting that out made no difference except that the log line "requests.packages.urllib3.connectionpool: Starting new HTTPS connection (1): tuner.pandora.com" goes away.

Maybe something to do with "PandoraFrontendFactory"?

@jcass77
Copy link
Member

jcass77 commented Jan 8, 2016

PandoraFrontendFactory didn't exist in version 0.1.7, so it is unlikely that that could be the cause.

@kdbdallas
Copy link
Author

Where SHOULD Pandora be showing in the UI?
Like if you look at the UI images I posted above, where SHOULD it be showing?
That might be a good place for me to start debugging, once I know.

@jcass77
Copy link
Member

jcass77 commented Jan 8, 2016

In the Musicbox-Webclient, it should show under the 'Browse' section:

pandora_browse-1

@kdbdallas
Copy link
Author

So I reinstalled Mopidy and now it shows up!
However now I am to a new problem... LOL

When I try and play anything I get no sound and the following shows up in my logs:

ERROR [1746:Core-15] mopidy.core.library: PandoraBackend backend caused an exception.
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/mopidy/core/library.py", line 19, in _backend_error_handling
    yield
  File "/usr/lib/python2.7/dist-packages/mopidy/core/library.py", line 236, in lookup
    result = future.get()
  File "/usr/lib/python2.7/dist-packages/pykka/threading.py", line 52, in get
    compat.reraise(*self._data['exc_info'])
  File "/usr/lib/python2.7/dist-packages/pykka/compat.py", line 12, in reraise
    exec('raise tp, value, tb')
  File "/usr/lib/python2.7/dist-packages/pykka/actor.py", line 201, in _actor_loop
    response = self._handle_receive(message)
  File "/usr/lib/python2.7/dist-packages/pykka/actor.py", line 295, in _handle_receive
    return callee(*message['args'], **message['kwargs'])
  File "/home/pi/mopidy-pandora/mopidy_pandora/library.py", line 82, in lookup
    track_kwargs['bitrate'] = int(pandora_track.bitrate)
TypeError: int() argument must be a string or a number, not 'NoneType'

@jcass77
Copy link
Member

jcass77 commented Jan 9, 2016

Ok sounds like good progress.

Those are probably development branch-related dependency issues. The bitrate field was only introduced in pydora 1.6.3 or 1.6.4 - updating that might fix the problem.

It might be simpler to just stick to the latest released version of Mopidy-Pandora for now (0.1.8). We've got some major changes underway in develop that will only really be stable when the next maintenance releases of pydora and Mopidy are available (which fix a few subtle bugs that have and adverse effect on Mopidy-Pandora).

@kdbdallas
Copy link
Author

Sorry for the delay in getting back. I ran into a Mopidy issue which held me up in checking this out. Anyways, going back to the stable branch fixed this, and I now have a working setup!
Thank you for all of your help!
Above and beyond right here!

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

No branches or pull requests

3 participants