janbar / noson-app

The essential to control music from your SONOS devices on Linux platforms
GNU General Public License v3.0
341 stars 28 forks source link

Fails to start registering the Google Play Service #10

Open EelcoA opened 7 years ago

EelcoA commented 7 years ago

First big thanks for this very nice Sonos App, I'm enjoying it. Made me upgrade from 14.04 to 16.04 ;-)

I try to register my Google Play service, but pressing the green button gives no response. 7Digital and TuneIn worked direct. Soundcloud works as well after registration.

Any suggestions?

kind regards, Eelco

ghostal commented 7 years ago

Thanks also!

I am having the same problem with Google Play Music - clicking the "Start service registration" button shows the loading spinner for a short moment, but then it disappears and nothing happens.

Service registration for Spotify, for example, works fine though.

EelcoA commented 7 years ago

I noticed that, although registration failed, Google Play does function. I have a Google Music link added to my favorites and it works! So registration is working, or not necessary.

ghostal commented 7 years ago

@EelcoA Are you able to search and browse through Google Play Music?

EelcoA commented 7 years ago

@ghostal Nope, I can only play albums or lists from Google PLay that I've added to my Favorites, no browsing.

janbar commented 7 years ago

Hi, There is an issue in the protocol with Google. The sonos api documentation available from web seems to be obsolete. Once I have more info, I will patch the app.

janbar commented 7 years ago

I fixed a xml hearder for smapi. Could someone check the new version 2.4.0 for Google service registration issue. Thanks.

EelcoA commented 7 years ago

I just installed noson-app_2.4 through, but Google Play is still not working. 7Digital, Soundcloud work fine. Google Play still has the same issue. And this is weird, because the entry for the random mix for google play in my Favorites does work. So I can play songs, but can not browse them.

BTW, I could only see that I got version 2.4.0. through the update log. I could not find it anywhere in the app (screen of files) itself. Would be nice to be able to check that I am indeed running the right version.

Anyhow, thanks for trying, and I do enjoy the app a lot, keep up the good work!

pascalopitz commented 7 years ago

What user agent string are you guys using? I recently found out Google Play's pretty fickle. Soco provided the answer: https://github.com/SoCo/SoCo/blob/18ee1ec11bba8463c4536aa7c2a25f5c20a051a4/soco/music_services/music_service.py#L55

janbar commented 7 years ago

@pascalopitz many thanks for the clear steer. I use the user agent libnoson/1.0. Seems it should be the root cause of the issue. I will fix as soon as possible.

pascalopitz commented 7 years ago

No worries. I had the same issue.

janbar commented 7 years ago

In fact, I used the agent string from sonos device itself: Linux UPnP/1.0 Sonos/36.4-42130 (ZP90). Using the string from device response as Linux UPnP/1.0 Sonos/36.4-42130 fails again. But using the string Linux UPnP/1.0 Sonos/26.99-12345 make it work now ! Really weird.

janbar commented 7 years ago

And more pending authorization, the fault code returned by Google api doesn't match with the protocol specifications of the Sonos API. The fault code returned is soap:server instead NOT_LINKED_RETRY.

janbar commented 7 years ago

I pushed the update. The build is running now for PPA packages and SNAP package using last release 2.4.2. You can check the version of the noson core library at url http://localhost:1400/ after launching the app. The latest version of the core library fixing this issue is 1.4.2. The app version is 2.4.2.

janbar commented 7 years ago

@EelcoA , please let me know if you solved the issue with the latest version. Thanks for your help.

EelcoA commented 7 years ago

@janbar I received the new version, new broker 1.4.2, but don't know app version, how can I check that?

Anyhow, we're one step further :-) But not there yet. Clicking on the button to start the registration gives me a url: https://www.google.com/device. With that url I have to log into Google, pick the desired google account, and then it asks for a code that should be shown on the device. Apparently now Noson has to show a number, but doesn't.

See attached screenprint (in dutch)

schermafdruk van 2017-07-20 09-37-00

pascalopitz commented 7 years ago

AppLink and DeviceLink responses contain linkCode and showLinkCode. If the latter is true, the former is to be displayed to the user.

            <xs:complexType name="deviceLinkCodeResult">
                <xs:sequence>
                    <xs:element name="regUrl" type="xs:string"/>
                    <xs:element name="linkCode" type="xs:string"/>
                    <xs:element name="showLinkCode" type="xs:boolean"/>
                    <xs:element name="linkDeviceId" type="xs:string" minOccurs="0"/>
                </xs:sequence>
            </xs:complexType>
janbar commented 7 years ago

I missed those stuff... My new update in version 2.4.3 shows screens below:

capture du 2017-07-20 13-45-06 capture du 2017-07-20 13-45-25

Hope it will help ! I can't test it because I haven't a Google Play account.

EelcoA commented 7 years ago

I do get in now, although, it looks like that. Authorisation is granted, but all is empty, no albums, no artists, no songs. All empty ;-( Only the playlists are shown, but also empty.

janbar commented 7 years ago

Are containers (folder Albums,Artists...) show ? And they are empty...

EelcoA commented 7 years ago

First time they were shown, but empty. And Playlist showed my playlists, only they were empty too. Now (I had to restart my computer) the containers are not shown.

BTW, You can sign up for Google Play for free and upload some albums, no need to pay. It is how I use it, as a cloud backup for my music. Just in case you didn't know.

afbeelding

janbar commented 7 years ago

I didn't know ! Now I am trying a free account for the Google play service. I will let you know what I can do.

janbar commented 7 years ago

That works now, and it allows me to fix a bug in my shared code. Thanks for your contribution.

janbar commented 7 years ago

Fixed version is : 2.4.4 (core lib 1.5.1)

EelcoA commented 7 years ago

Yes, it works! Had to remove the .cache folder, but after that, like a charm :-) Thanks. And you're not the first one I tell about the awesome free cloud option of Google Play. Enjoy, glad I could help.

EelcoA commented 7 years ago

@janbar unfortunately, the Google Play Musice service does not work any more. It still says 'Google Play Eelco', but clicking on it fails to show anything. Not even the containers. 7Digital and Soundcloud work. Any way I can remove all settings to start it all over again?

janbar commented 7 years ago

Mmm. Probably the token refreshing fails. This service is fussy. I will test it this evening with my account.

janbar commented 7 years ago

@EelcoA , here it works. The token is refreshed normally (at every new instance of the service). Running noson-app with option --debug you should see something like that when entering in the service first time:

(SONOS)Connect: SSL handshake initialized
(SONOS)Connect: /C=US/ST=California/L=Mountain View/O=Google Inc/CN=*.googleapis.com
(SONOS)SendRequest: POST /music/sonos/wsf/smapi HTTP/1.1
Host: mclients.googleapis.com:443
User-Agent: Linux UPnP/1.0 Sonos/26.99-12345
Connection: close
Accept-Charset: utf-8
Content-Type: text/xml; charset=utf-8
Content-Length: 751
Accept-Encoding: gzip, deflate
Accept-Language: fr_FR, en-US;q=0.9
SOAPAction: "http://www.sonos.com/Services/1.1#getMetadata"

<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Header><credentials xmlns="http://www.sonos.com/Services/1.1"><deviceId>XXXXXXXXX:0</deviceId><deviceProvider>Sonos</deviceProvider><loginToken><token>HHID_XXXXXXXXXX</token><key>XXXXXXXXXXXXXXXX</key><householdId>HHID_XXXXXXXXXXXXXX</householdId></loginToken></credentials></s:Header><s:Body><ns:getMetadata xmlns:ns="http://www.sonos.com/Services/1.1"><ns:id>root</ns:id><ns:index>0</ns:index><ns:count>100</ns:count><ns:recursive>false</ns:recursive></ns:getMetadata></s:Body></s:Envelope>
(SONOS)GetResponse: HTTP/1.1 500 Internal Server Error
(SONOS)GetResponse: Content-Type: text/xml; charset=UTF-8
(SONOS)GetResponse: Content-Encoding: gzip
(SONOS)GetResponse: Date: Mon, 24 Jul 2017 18:53:20 GMT
(SONOS)GetResponse: Expires: Mon, 24 Jul 2017 18:53:20 GMT
(SONOS)GetResponse: Cache-Control: private, max-age=0
(SONOS)GetResponse: X-Content-Type-Options: nosniff
(SONOS)GetResponse: X-Frame-Options: SAMEORIGIN
(SONOS)GetResponse: X-XSS-Protection: 1; mode=block
(SONOS)GetResponse: Server: GSE
(SONOS)GetResponse: Alt-Svc: quic=":443"; ma=2592000; v="39,38,37,36,35"
(SONOS)GetResponse: Connection: close
(SONOS)GetResponse: Transfer-Encoding: chunked
(SONOS)GetResponse: 
(SONOS)WSResponse: server error (500)
(SONOS)ReadChunk: chunked data (00000001)
(SONOS)ReadChunk: chunked data (00000001)
(SONOS)ReadChunk: chunked data (00174)
(SONOS)DoCall: [fault] authToken = XXXXXXXXXXXXXXXXXXX
(SONOS)DoCall: [fault] privateKey = XXXXXXXXXXXXXXXXXXX
(SONOS)SetFault: TAG (Fault)
(SONOS)SetFault: faultcode (soap:Client.TokenRefreshRequired)
(SONOS)SetFault: faultstring (Client.TokenRefreshRequired)
(SONOS)SetFault: authToken (XXXXXXXXXXXXXXXXXXXXXXXX)
(SONOS)SetFault: privateKey (XXXXXXXXXXXXXXXXXXXXXXXX)
(SONOS)Connect: SSL handshake initialized
(SONOS)Connect: /C=US/ST=California/L=Mountain View/O=Google Inc/CN=*.googleapis.com
(SONOS)SendRequest: POST /music/sonos/wsf/smapi HTTP/1.1
Host: mclients.googleapis.com:443
User-Agent: Linux UPnP/1.0 Sonos/26.99-12345
Connection: close
Accept-Charset: utf-8
Content-Type: text/xml; charset=utf-8
Content-Length: 850
Accept-Encoding: gzip, deflate
Accept-Language: fr_FR, en-US;q=0.9
SOAPAction: "http://www.sonos.com/Services/1.1#getMetadata"

<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Header><credentials xmlns="http://www.sonos.com/Services/1.1"><deviceId>XXXXXX:0</deviceId><deviceProvider>Sonos</deviceProvider><loginToken><token>XXXXXXXXXXXXXXXXX</token><key>XXXXXXXXXXXXXXXXXXXXXX</key><householdId>HHID_XXXXXXXXXX</householdId></loginToken></credentials></s:Header><s:Body><ns:getMetadata xmlns:ns="http://www.sonos.com/Services/1.1"><ns:id>root</ns:id><ns:index>0</ns:index><ns:count>100</ns:count><ns:recursive>false</ns:recursive></ns:getMetadata></s:Body></s:Envelope>
(SONOS)GetResponse: HTTP/1.1 200 OK
(SONOS)GetResponse: Content-Type: text/xml; charset=UTF-8
(SONOS)GetResponse: Content-Encoding: gzip
(SONOS)GetResponse: Date: Mon, 24 Jul 2017 18:53:21 GMT
(SONOS)GetResponse: Expires: Mon, 24 Jul 2017 18:53:21 GMT
(SONOS)GetResponse: Cache-Control: private, max-age=0
(SONOS)GetResponse: X-Content-Type-Options: nosniff
(SONOS)GetResponse: X-Frame-Options: SAMEORIGIN
(SONOS)GetResponse: X-XSS-Protection: 1; mode=block
(SONOS)GetResponse: Server: GSE
(SONOS)GetResponse: Alt-Svc: quic=":443"; ma=2592000; v="39,38,37,36,35"
(SONOS)GetResponse: Connection: close
(SONOS)GetResponse: Transfer-Encoding: chunked
(SONOS)GetResponse: 
(SONOS)ReadChunk: chunked data (00000001)
(SONOS)ReadChunk: chunked data (00000001)
(SONOS)ReadChunk: chunked data (00000001)
(SONOS)ReadChunk: chunked data (00000001)
(SONOS)ReadChunk: chunked data (01)
(SONOS)ReadChunk: chunked data (19e)
(SONOS)DoCall: dump (getMetadataResult)
<getMetadataResult>
    <index>0</index>
    <count>2</count>
    <total>2</total>
    <mediaCollection>
        <id>pxIasSYsGYc</id>
        <itemType>program</itemType>
        <title>Mix "J'ai de la chance"</title>
        <canPlay>true</canPlay>
        <canEnumerate>true</canEnumerate>
        <albumArtURI>https://www.gstatic.com/play/music/sonosfe/XXXXXX/images/orange/ifl_icon_72.png</albumArtURI>
    </mediaCollection>
    <mediaCollection>
        <id>uNSX3oy6his</id>
        <itemType>favorites</itemType>
        <title>Bibliothèque musicale</title>
        <albumArtURI>https://www.gstatic.com/play/music/sonosfe/XXXXXX/images/orange/mylibrary_icon_72.png</albumArtURI>
    </mediaCollection>
</getMetadataResult>

(SONOS)GetItems: [0] mediaCollection (program)(pxIasSYsGYc)
(SONOS)MakeUriMetadata: sid 151 (000c206cpxIasSYsGYc)(0)
(SONOS)GetItems: [1] mediaCollection (favorites)(uNSX3oy6his)
janbar commented 7 years ago

You can run the app with flag --debug and save the log into file with the following command:

noson-app --debug 2>&1 | tee noson.log

Do not paste the file here because it contains credentials.

EelcoA commented 7 years ago

@janbar So I did, and now? what to look for. A bit too much data for me to go through. ;-)

Although I see one weird thing already, that it gets errors trying to retrieve images from an old ip address that used to contain my music. But since all is working well on SONOS with the new NAS address, that is a bit weird.

But that has nothing to do with the Google Play service (or at least shouldn't). Can I send you the log file?

janbar commented 7 years ago

Yes, you can send the log file to my email address: jlbarriere68@gmail.com

janbar commented 7 years ago

@EelcoA , please could you request with a web browser the url:

http://192.168.1.120:1400/status/accounts

Then check if you have a value for the field OADevID for the account Google. Seems the App didn't extract the required value.

janbar commented 7 years ago

The "Google" account has the type number 38663. capture du 2017-07-25 20-23-21

EelcoA commented 7 years ago

The request delivers nothing, not in the browser, not with wget, although the Google Play component still mentions my name:

afbeelding

janbar commented 7 years ago

No problem, it seems that could depend of the sonos device and firmware version. I saw the issue in your debug log for the google account. Your sonos device no longer provides a value for field "OADevID" in the accounts request response. I will make an update soon to default the value with the "householdID" of the device. Then that should work again.

janbar commented 7 years ago

Finishing the fix, the Google service no longer work here now ! They probably changed something in their api today that break the client with error: "Unable to authorize Google Play Music. Please contact Sonos Customer Care."

janbar commented 7 years ago

@pascalopitz have you a failure too with Google service since few hours ?

pascalopitz commented 7 years ago

Yes, indeed :(

On 27 July 2017 at 08:17, Jean-Luc Barrière notifications@github.com wrote:

@pascalopitz https://github.com/pascalopitz have you a failure too with Google service since few hours ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/janbar/noson-app/issues/10#issuecomment-318204868, or mute the thread https://github.com/notifications/unsubscribe-auth/AAQlfB6KqPaTX7s972aiIXXy3gP58Cc2ks5sR8HqgaJpZM4M__2G .

EelcoA commented 7 years ago

And maybe it is part of the problem, but it seems that Noson does not remember the credentials for 7Digital and Soundcloud. Every time I have to go through the registration process again.

EelcoA commented 7 years ago

Just installed new version of Noson (Event Broker Version 1.5.4, compiled on Jul 27 2017 at 12:18:33 ) and removed the .config/noson.janbar/noson.janbar.conf.

Registered for

janbar commented 7 years ago

Thanks for feedback. Since few weeks ago some services using "userId" registration, they expire the session after one day or few hours (i.e 7Digital). Because Noson doesn't store your password , you have to enter it again after expiration. I am pushing now an update with the version 2.4.7 (1.5.5), to fill the "username" because it can be retrieved from Sonos device. So you will have to enter only your password to re-enable the service session. About Google service, seems that's broken for now, caused by their API update occurred yesterday.

EelcoA commented 7 years ago

@janbar Thanks for the update. Username was shown for 7digital, so only had to enter the password. You don't want Noson to store the passwords (encrypted)? Would be nice. For Soundcloud I had to register again as well. How does Sonos do that then? There I never have to re-register?

janbar commented 7 years ago

Sonos stores your password, also its sources aren t open like noson.

janbar commented 7 years ago

Weird Soundcloud expires your session as soon ! Maybe the session id failed to be stored on noson config.

janbar commented 7 years ago

@EelcoA , so finally I reviewed my opinion and the version 2.4.8 (1.5.5) will store password into account settings to allow auto registration. So once the current session becomes expired the app will request one time the password and keep it into settings to enable automatic session refreshing. That's work here with 7Digital, and Deezer.

EelcoA commented 7 years ago

@janbar 7Digital and Soundcloud work and keep working, thanks!

luisgjb commented 6 years ago

i have the same problem with Apple music.. in the log the only thing that i think is important is this : (SONOS)__dumpInvalidResponse: invalid or not supported response (SONOS)<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> SOAP-ENV:Header/ SOAP-ENV:Body SOAP-ENV:Fault SOAP-ENV:Server There was an error processing your request 999 </SOAP-ENV:Fault> </SOAP-ENV:Body> </SOAP-ENV:Envelope> (SONOS)GetAppLink: parse xml failed

davparker commented 6 years ago

Just installed this on Ubuntu Desktop 18.04. I had to register Pandora 3 tries before it took. The web registration succeeded, but the Noson app kept saying I needed to register again. But, third time was the charm. With Google Play, the web registration link never opens. But, cool, I mostly use Pandora anyway. Thanks!

benhbell commented 6 years ago

Running into this issue with the latest noson on ubuntu 18.04 as well.

geblix3000 commented 6 years ago

At first...great work!

But same problem, with Apple Music. Using Manjaro with all latest packages and installes your app via Snap Packages. I get the same error as mentioned from user "luisgjb" 2 comments above.

Zabari commented 5 years ago

Same problem with Google Play :( any leads?