Mopidy-Gmusic not authenticating

I started with a fresh install of pimusicbox today - and after fiddling around with the solution mentioned above I ran into a dead-end and have to reinstall the image. Is there anyone out there with a working solution for now? Then a share would be really appreciated, because I’m still somewhat new to the matter :smile:

Think I’m going to have to go for a fresh install too. I tried the steps above but now can’t get to musicbox.local. AirPlay still works and everything looks ok but clearly something isn’t…

Hi,

I’ve tried all of the above in all different manners this morning (5 hours of trying) and have got absolutely nowhere. This is with a fresh install of PiMusicBox. I don’t know enough to try to branch out and work through the problems so am having to give up for now. I’m at a point where I can’t connect to the webclient anymore (either via ip or http://musicbox.local) - it times out trying to connect so will need to reinstall. I’m just hoping someone can help:

Am I wasting my time and need to wait for a new release before this is fixed? Or…
Does the above still work, I’m just clearly not doing something correctly?

I’d really appreciate any help anyone can give!

Thanks.

I’ve just read here: https://github.com/simon-weber/gmusicapi/issues/338 that you have to “switch on the develop branch of gmusicapi.” and “In order to overcome the problem with the change on the Google-side, we have to switch on new gmusicapi. To switch I had to change the code of gmusicproxy (today commits). You have to update both of them.”

Would someone be kind enough to let me know what it is I have to do exactly to achieve this please?

Thanks :slight_smile:

When I had originally posted this, I had everything working. A few days later, the web interface broke and when I apt-get upgraded, everything broke. I have since abandoned pi music box and am building a mopidy/mopify server with raspbian. I’m leaving the following here because someone might find it useful.

== begin original post ==

TLDR:
the google music portion of mopidy that ships with the current version of pi music box is out of date and must be updated.
So you have to manually install the development version.
However installing the development version gets you into dependency hell.
As of today, you can start with a clean version of the latest pi music box and get google music working if you type the following:

In the mopidy config:
add user@gmail.com
add password (disable two-factor auth if you use it on your google account if you are lazy or use a unique application password for it. You can get one at h**ps://myaccount.google.com)
add google services framework id

apt-get update
apt-get upgrade
apt-get install python-dev
apt-get install build-essential
apt-get install python-crypto
wget https://bootstrap.pypa.io/ez_setup.py -O - | python
apt-get install libffi-dev
wget https://github.com/simon-weber/Unofficial-Google-Music-API/archive/develop.zip
pip install --upgrade develop.zip
pip install funcsigs
nano /usr/local/lib/python2.7/dist-packages/mopidy_gmusic/session.py

ctrl+c to show the current line number
somewhere around line 21, you’ll need to add “test”(or any string in quotes) so that the line looks like this:

if not self.api.login(username, password, “test”):

further down the file change the get_thumbs_up_songs method to look like this:

def get_thumbs_up_songs(self):
return {}

reboot

You should NOT turn off two-factor auth to get Mopidy-GMusic working. Simply use an unique application password for it. You can get one at https://myaccount.google.com/.

thanks, I edited my post to include this

I am having issues.
Keep getting the : ERROR Failed to login as "mygoogleusername"
I am using the mopidy-gmusic.git@develop version.
I have mfa on my google account.
I created an unique application password but am not really sure what to do with it.

Nevermind!
Finally got it!

Finally got this working with the following, some dependancies were missing from a fresh install so there are added.

apt-get update

apt-get upgrade

apt-get install python-dev build-essential libssl-dev libffi-dev

apt-get install python-crypto

wget https://github.com/simon-weber/Unofficial-Google-Music-API/archive/develop.zip

pip install --upgrade setuptools

pip install --upgrade develop.zip

pip install funcsigs

cd /usr/local/lib/python2.7/dist-packages/mopidy_gmusic

nano session.py

change

if not self.api.login(username, password):

to

if not self.api.login(username, password, deviceid):

Change

get_thumbs_up_songs to:

def get_thumbs_up_songs(self):
return {}

With Mopidy-GMusic 1.0.0, there should be no need for hacking the installed
source yourself. How did you end up with an older version?

I’m using the latest version of PiMusicbox, that cannot stream from Google
Play Music.

Running a Pi MusicBox 0.6.0 release here and hitting the same wall. I do use 2-factor authentication and unless I’m mistaken I could have sworn that in order to utilize a revocable password you had to use it against a Google service somewhere else before MusicBox could actually run with it.

Ayway, here’s the result of the Mopidy logs and pip list of Google-related packages:

gmusicapi (4.1.0.dev0)
Mopidy-GMusic (0.3.0)

2016-01-04 20:53:41,757 - INFO     Starting new HTTPS connection (1): www.google.com
2016-01-04 20:53:42,034 - INFO     failed to authenticate
2016-01-04 20:53:42,038 - ERROR    Failed to login as "email@gmail.com"
2016-01-04 20:53:42,040 - INFO     Start refreshing Google Music library
2016-01-04 20:53:42,041 - INFO     Loaded 0 playlists from Google Music
2016-01-04 20:53:42,042 - INFO     Finished refreshing Google Music content in 0s

Hope this gets sorted soon, I’m missing using my Pi for Google Music.

I think I ended up breaking my MusicBox installation while trying to get Gmusic to work.

As a workaround, I’ve been simply running the Gmusic app on my iPhone and playing it on the PMB via AirPlay.

I’ve read somewhere around here that in order to get Gmusic to authenticate on PMB you have to have a paid Google Music subscription but I cannot find anything “official” to confirm or deny that.

my problem isn’t the authentication when the system boots up, but when I try to play a track.

on boot up the logs show:

2016-01-09 17:01:57,361 - INFO Starting new HTTPS connection (1): android.clients.google.com
2016-01-09 17:01:57,928 - INFO authenticated
2016-01-09 17:01:57,930 - INFO Start refreshing Google Music library
2016-01-09 17:01:58,178 - INFO Starting Mopidy frontends: MpdFrontend, HttpFrontend
2016-01-09 17:01:58,185 - INFO MPD server running at [::ffff:0.0.0.0]:6600
2016-01-09 17:01:58,193 - INFO HTTP server running at [::ffff:0.0.0.0]:6680
2016-01-09 17:01:58,902 - INFO Starting new HTTPS connection (1): mclients.googleapis.com
2016-01-09 17:02:21,263 - INFO Loaded 6 playlists from Google Music
2016-01-09 17:02:21,264 - INFO Finished refreshing Google Music content in 23s

I can see my library in the web interface, albums and artists, but when I try to play a track, nothing happens. In the logs I get:

> 2016-01-09 17:10:37,765 - INFO     Starting new HTTPS connection (1): android.clients.google.com
> 2016-01-09 17:10:38,254 - ERROR    Failed to lookup "f2efe892-ae10-322c-b662-904ba8799f08": GetStreamUrl: 403 Client Err
> or: Forbidden
> (requests kwargs: {'url': 'https://android.clients.google.com/music/mplay', 'headers': {'X-Device-ID': u'test', u'Author
> ization': '<omitted>'}, 'allow_redirects': False, 'params': {'opt': u'hi', 'songid': u'f2efe892-ae10-322c-b662-904ba8799
> f08', 'pt': 'e', 'slt': '1452359437758', 'sig': 'msDjOAJ5qsBBjPwWKPuWYahZQYs', 'net': 'mob'}, 'method': 'GET'})
> (response was: '<HTML>\n<HEAD>\n<TITLE>Forbidden</TITLE>\n</HEAD>\n<BODY BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>Forbidde
> n</H1>\n<H2>Error 403</H2>\n</BODY>\n</HTML>\n')
> 2016-01-09 17:10:38,256 - WARNING  Track is not playable: gmusic:track:f2efe892-ae10-322c-b662-904ba8799f08

I’ve also tried this with a real device id (my phone’s) but I get the same messages

It’s returning an HTTP 403 error (Forbidden) which usually means bad credentials. Do you have a paid subscription with Google Music?

I don’t have a paid account, but I was trying to play something from my library. Is this only working with paid accounts?

That is my suspicion.

You must have a Google account, and either:

  • have some music uploaded to your Google Play Music library, or
  • have a subscription for Google Play Music All Access.

Quote: GitHub - mopidy/mopidy-gmusic: DEPRECATED (Mopidy extension for playing music from Google Play Music)

OK, I have a google account, and I already have all my music uploaded to google music.
Since my last post, I have now joined the google music free trial, so let’s say I have the paid subscription.
I have manually changed the allmusic value in settings.ini to true
I have tried with and without a device ID
I see my library and a list of radios in the web interface
the mopidy logs say I authenticate to android.clients.google.com
but I still have the
Failed to lookup “af631746-d622-3c89-8f07-52142cab9287”: GetStreamUrl: 403 Client Err
or: Forbidden
when I try to play a track