hechtus / squeezebox-googlemusic

Squeezebox (Logitech Media Server) Plugin for Google Play Music
103 stars 24 forks source link

Can't login #88

Open MaestroZ opened 9 years ago

MaestroZ commented 9 years ago

Hi, Unfortunately today my Rasp Pi rebooted and now I can't login anymore to Google Play Music The only message I have is : Plugins::GoogleMusic::Settings::handler (75) Not able to login to Google Play Music: exceptions.TypeError: login() takes exactly 4 arguments (3 given) at (eval 877) line 182.

Tried every possibility listed in issue 84 to avail I suppose that Google Authentication new policy is the culprit.

Too bad ;-(

MaestroZ

sundown94 commented 9 years ago

Same here. I have spent the past week, off and on, trying every possibility and combination of other people's solutions posted here, but nothing seems to work. I have only been successful in going from the "login error" to having the "plug-in cannot load" error, and then fixing the "plug-in cannot load" error so that it is back now to the "login error". I was really enjoying my cheap Sonos alternative using Raspberry Pis since I started this a few months ago, but my heart is really starting to sink. :-( I wish someone who has gotten it to work successfully with a Raspberry Pi could post actual versions of everything critical (Raspian? Python? LMS? Gmusicapi? Plug-In? etc.). If I get it to work, I will definitely post back up here.

MaestroZ commented 9 years ago

Hi, searched deeper into it. I noticed that in gmusicapi v7 you can read in the mobileclient.py that :

def login(self, email, password, android_id): """Authenticates the Mobileclient. Returns True on success, False on failure. :param email: eg 'test@gmail.com' or just 'test'. :param password: the account's password. This is not stored locally, and is sent securely over SSL. App-specific passwords are not supported. :param android_id: 16 hex digits, eg '1234567890abcdef'.

the interesting part is : " App-specific passwords are not supported." !!

This is exactly what I use for security reasons I can't test just yet but maybe there's a problem here.

MaestroZ

sundown94 commented 9 years ago

OK, I finally got it to work. And I stumbled across a REAL BIG surprise that caused me lots of wasted time. The surprise is that the LMS web interface and Google Music Plug-In (0.4.2 from Nick7634) tell me that I have entered a bad user name and password, but if I go out to the command line and manually restart LMS with this "supposed" bad user name and password, it actually starts up and logs in successfully. It finally says that I am logged in at the top of the plug-in settings page when I check. However, if I click the "Apply" button for the heck of it, it switches back and tells me again that I have a bad username and password even though I don't (another simple restart of LMS allows it to successfully log back in). This means that I cannot rely on the web interface to log in. And this issue probably made me believe that I still had software problems several times over. So bottom line is that I reverted all the way back to my original LMS setup (thankfully I had saved a disk image of my Raspberry Pi before starting all of this) and did the following:

  1. Uninstall the old Gmusicapi: sudo service logitechmediaserver stop sudo pip uninstall git+https://github.com/simon-weber/Unofficial-Google-Music-API.git@develop
  2. Make sure I have a good installation of python pip: sudo wget https://bootstrap.pypa.io/get-pip.py sudo python get-pip.py sudo reboot
  3. For me, I had to install libffi-dev, otherwise I got "wheel" errors when installing the new version of Gmusicapi: sudo service logitechmediaserver stop sudo apt-get install libffi-dev sudo reboot
  4. Now reinstall Gmusicapi (the dev version, which as of this posting is 7.0.0): sudo service logitechmediaserver stop sudo pip install --upgrade git+https://github.com/simon-weber/Unofficial-Google-Music-API.git@develop
  5. You might be able to skip this, but I also reinstalled the CPAN Inline stuff: sudo cpan App::cpanminus sudo cpanm --notest --reinstall Inline sudo cpanm --notest --reinstall Inline::Python sudo reboot
  6. Install the Google Plug-in. These steps all assume that your previous userid, password, and deviceid are populated and were originally working: a.) From the web interface, uncheck the old Google plugin and Click APPLY. Before restarting, also remove the old repository. When you do this, LMS will still remember your userid, password, and deviceid: b.) From the command line, stop and start LMS: sudo service logitechmediaserver stop sudo service logitechmediaserver start c.) Add the new repository from nick7634 and then enable the 0.4.2 plug-in. Restart LMS again: sudo service logitechmediaserver stop sudo service logitechmediaserver start d.) When LMS starts back up, it will use your original userid, password, and deviceid and should successfully sign in. It should reflect this at the top of the plug-in settings page (saying that you are signed in). If you had the wrong credentials, enter the correct ones and ignore the message about still having a bad username and password...just restart LMS and it logs in. At least it does for me. I also tried this successfully with the Google 2-step (or app specific) password mode.

By the way, I am currently using LMS 7.7.5 in case that matters, but I don't think it does (because I also got it to work with the 7.9 nightly version on my other Raspberry Pi during testing). My python version is the default that came with Raspian (I think it is 2.7.3), but it should at least work with 2.7.9 as well.

Hope this helps everyone.

Sundown94

MaestroZ commented 9 years ago

Hi Sundown94,

I folllowed the steps you listed, indeed it works when I updated gmusicapi to v7 in the first place I noticed errors linked to 'wheel' but I didn't know how to fix them and didn't have time to get back to it til' now the libffi-dev is absolutely necessary or gmusicapi is not built correctly I used app password to log in you're right the web interface is not to be trusted I had trouble accessing playlists' tracks but that was due to 'Enable All Access' checkbox not ticked (stupid !) Right now everything works as expected

Thanks a lot MaestroZ

rcalinjageman commented 9 years ago

This worked for me. Using LMS 7.9.0.

I had this problem crop up several weeks ago and followed the previous thread to switch to the nick7634 fork. Then, I switched back to the main branch when that thread had said the problem had been fixed, and it seemed to work just fine, until a reboot today produced the same problem again. Followed the procedure above (without the obsessive rebooting) and all working good. Many thanks.

sundown94 commented 9 years ago

Glad it helped!! During the numerous iterations that I went through to get this working myself, I originally was not rebooting nearly as many times. After a while I started to wonder if some installations needed a reboot in order for subsequent installations to be truly successful. Without knowing the answer to that question, I just started playing it safe by rebooting after each install (and luckily, my Raspberry Pi reboots in about 30 seconds so it didn't add much time/effort). :-)

samkarpluk commented 9 years ago

Tried working through @sundown94 steps but getting the following error:

Plugins::GoogleMusic::Plugin::initPlugin (95) Not able to login to Google Play Music: SSLError: hostname 'android.clients.google.com' doesn't match either of '.google.com', '.android.com', '.appengine.google.com', '.cloud.google.com', '.google-analytics.com', '.google.ca', '.google.cl', '.google.co.in', '.google.co.jp', '.google.co.uk', '.google.com.ar', '.google.com.au', '.google.com.br', '.google.com.co', '.google.com.mx', '.google.com.tr', '.google.com.vn', '.google.de', '.google.es', '.google.fr', '.google.hu', '.google.it', '.google.nl', '.google.pl', '.google.pt', '.googleadapis.com', '.googleapis.cn', '.googlecommerce.com', '.googlevideo.com', '.gstatic.cn', '.gstatic.com', '.gvt1.com', '.gvt2.com', '.metric.gstatic.com', '.urchin.com', '.url.google.com', '.youtube-nocookie.com', '.youtube.com', '.youtubeeducation.com', '.ytimg.com', 'android.com', 'g.co', 'goo.gl', 'google-analytics.com', 'google.com', 'googlecommerce.com', 'urchin.com', 'youtu.be', 'youtube.com', 'youtubeeducation.com' at line 64

MaestroZ commented 9 years ago

Hi samkarpluk,

I think the SSL error is due to gmusicapi not built properly when I updated to v7 I had multiple errors regarding 'wheel' during installation You need to :

MaestroZ

deradam commented 9 years ago

Thank you all for the instructions. I finally upgraded everything and the installation of the gmusicapi was successful also with respect to the wheel crypto stuff. I had to install openssl-dev though.

However when I try to play a song (search etc. is working) then I it does not start and I see the following on the console:

[15-07-24 23:52:35.4419] Slim::Utils::Misc::msg (1311) Warning: [23:52:35.4411] Async::HTTP: Unable to load IO::Socket::SSL, will try connecting to SSL servers in non-SSL mode [15-07-24 23:52:40.8507] Plugins::GoogleMusic::ProtocolHandler::getNextTrack (103) Looking up stream url for url googlemusic:track:Tvpvtkgg4ubi35wzfrnp5aautn4 failed: CallFailure: GetStreamUrl: 403 Client Error: Forbidden (requests kwargs: {'url': 'https://android.clients.google.com/music/mplay', 'headers': {'X-Device-ID': 'xxxxxxxxxxxx', 'Authorization': ''}, 'allow_redirects': False, 'params': {'opt': 'hi', 'mjck': 'Tvpvtxxxxxxxx, 'pt': 'e', 'slt': '14300000000', 'sig': 'E3SSa7-XXXXXXXXXXXX', 'net': 'mob'}, 'method': 'GET'}) (response was: '\n\nForbidden\n\n\n

Forbidden

\n

Error 403

\n\n\n') at line 2

Any ideas with this issue?

samkarpluk commented 9 years ago

@MaestroZ Thanks for the suggestions. I have updated everything as you suggested and now have a different error. On startup, I'm getting the following:

Plugins::GoogleMusic::Plugin::initPlugin (100) Not logged in to Google Play Music. Set your username and password.

I have the correct info plugged into the plugin settings. I've also checked/unchecked the "Disable SSL check" option.

samkarpluk commented 9 years ago

I have it working now. Generated a new app password for the lms, plugged that in, and restarted lms. Bingo Pajama!

richardhenwood commented 9 years ago

For what it's worth, on my CentOS 6 server, I also needed: openssl-devel