squeezebox-googlemusic / squeezebox-googlemusic

Squeezebox (Logitech Media Server) Plugin for Google Play Music
35 stars 14 forks source link

Re-authorise after timeout #10

Open askvictor opened 8 years ago

askvictor commented 8 years ago

Seems to require re-authorisation after a few days. Re-starting the squeezebox service fixes this, but really this should be handled internally

askvictor commented 8 years ago

example error from logs:

[16-08-22 09:27:00.0236] Plugins::GoogleMusic::AllAccess::get_album_info (377) Not able to get the album info for album ID XXXXX: CallFailure: GetAlbum: 401 Client Error: Unauthorized
(requests kwargs: {u'url': u'https://mclients.googleapis.com/sj/v2.4/fetchalbum', u'headers': {u'Authorization': u'<omitted>'}, u'params': {u'alt': u'json', u'nid': u'XXXXX', u'include-tracks': True}, u'method': u'GET'})
(response was: u'{\n "error": {\n  "errors": [\n   {\n    "domain": "global",\n    "reason": "authError",\n    "message": "Invalid Credentials",\n    "locationType": "header",\n    "location": "Authorization"\n   }\n  ],\n  "code": 401,\n  "message": "Invalid Credentials"\n }\n}\n') at line 2
rodhull commented 8 years ago

I'd observed this behaviour in Hechtus' version for a long time but not actually seen it in yours yet. Mine's been running for almost a week now without a restart. I use 2-step verification on my account too which makes it even more annoying when it does happen since you have to revoke/re-generate a OTP...

eduvik commented 8 years ago

Interesting; haven't actually changed much code since forking; could be to do with the gmusicapi library.

Shouldn't need to get new otpassword every time; I'd a thunk that just a restart on the server would suffice

rodhull commented 8 years ago

The restart didn't seem to sort it for me previously - it was always necessary to re-generate the OTP - I would still get "invalid credentials" errors without it...I suspect a gmusicapi change has affected this (for me at least for the better!)

mbelleville commented 8 years ago

I have the same behavior as askvictor. Things will work fine for a day or 2, then I will get authorization errors and I need to restart logitech media server to fix.

[16-09-09 11:34:25.0006] Plugins::GoogleMusic::AllAccess::get_track (188) Not able to get the track info for track ID Tqdvvhnxyqqoryk4c74qgi6m77i: CallFailure: GetStoreTrack: 401 Client Error: Unauthorized
(requests kwargs: {u'url': u'https://mclients.googleapis.com/sj/v2.4/fetchtrack', u'headers': {u'Content-Type': u'application/json', u'Authorization': u''}, u'params': {u'tier': u'aa', u'alt': u'json', u'hl': u'en_US', u'nid': u'Tqdvvhnxyqqoryk4c74qgi6m77i'}, u'method': u'GET'})
(response was: u'{\n "error": {\n  "errors": [\n   {\n    "domain": "global",\n    "reason": "authError",\n    "message": "Invalid Credentials",\n    "locationType": "header",\n    "location": "Authorization"\n   }\n  ],\n  "code": 401,\n  "message": "Invalid Credentials"\n }\n}\n') at line 2
[16-09-09 11:34:25.0370] Plugins::GoogleMusic::AllAccess::get_track (188) Not able to get the track info for track ID Tqdvvhnxyqqoryk4c74qgi6m77i: CallFailure: GetStoreTrack: 401 Client Error: Unauthorized
(requests kwargs: {u'url': u'https://mclients.googleapis.com/sj/v2.4/fetchtrack', u'headers': {u'Content-Type': u'application/json', u'Authorization': u''}, u'params': {u'tier': u'aa', u'alt': u'json', u'hl': u'en_US', u'nid': u'Tqdvvhnxyqqoryk4c74qgi6m77i'}, u'method': u'GET'})
(response was: u'{\n "error": {\n  "errors": [\n   {\n    "domain": "global",\n    "reason": "authError",\n    "message": "Invalid Credentials",\n    "locationType": "header",\n    "location": "Authorization"\n   }\n  ],\n  "code": 401,\n  "message": "Invalid Credentials"\n }\n}\n') at line 2
[16-09-09 11:34:31.9906] Plugins::GoogleMusic::AllAccess::get_track (188) Not able to get the track info for track ID Tqdvvhnxyqqoryk4c74qgi6m77i: CallFailure: GetStoreTrack: 401 Client Error: Unauthorized
(requests kwargs: {u'url': u'https://mclients.googleapis.com/sj/v2.4/fetchtrack', u'headers': {u'Content-Type': u'application/json', u'Authorization': u''}, u'params': {u'tier': u'aa', u'alt': u'json', u'hl': u'en_US', u'nid': u'Tqdvvhnxyqqoryk4c74qgi6m77i'}, u'method': u'GET'})
(response was: u'{\n "error": {\n  "errors": [\n   {\n    "domain": "global",\n    "reason": "authError",\n    "message": "Invalid Credentials",\n    "locationType": "header",\n    "location": "Authorization"\n   }\n  ],\n  "code": 401,\n  "message": "Invalid Credentials"\n }\n}\n') at line 2
mbelleville commented 8 years ago

I managed to solve the problem by adding my google play music account to another android phone, then using the Mobile Device ID of this newly added phone for my google music squeezebox plugin. I then deleted the account from that other android phone.

I have been up and running for 7 straight days now. Before that I was only able to get 3 days of uptime max before I needed to restart LMS. Looks like I'm all set.

davewongillies commented 6 years ago

Is anyone still experiencing this bug? I'd be curious to know what version of gmusicapi is installed on peoples' systems.

davewongillies commented 6 years ago

That said, it wouldn't be a completely terrible idea to retry auth. I've noticed when rebooting my server running LMS, that if LMS starts up before networking is available, this plugin will fail to login to Google Play Music and not work until LMS has been restarted.

madattack commented 6 years ago

Is anyone still experiencing this bug? I'd be curious to know what version of gmusicapi is installed on peoples' systems.

yes I am also experiencing this bug. I am on gmusicapi (10.1.2)