assistant-relay icon indicating copy to clipboard operation
assistant-relay copied to clipboard

Error creating new user

Open Destructorxdx opened this issue 2 years ago • 16 comments

Describe the bug I'm having trouble registering the ID of OAuth 2.0 clients

To Reproduce Steps to reproduce the behavior:

  1. Register a new account image

  2. Click Next

  3. The error will be displayed when registering the OAuth 2.0 client image

Expected behavior Show code to register account

Screenshots image

Desktop (please complete the following information): -Platform [Windows] -Browser [chrome] -Version [latest]

Destructorxdx avatar Mar 05 '22 22:03 Destructorxdx

I am having the exact same issue on 4.0.0 dev

caj380 avatar Mar 06 '22 03:03 caj380

I don't think this problem is related to the assistant-relay code.

I just followed Google-published instructions using python dev libraries to authenticate the assistant and received the same error posted above. I think something is broken on Google's end. The part of the URL that contains redirect_uri params matches the format in the error message.

https://developers.google.com/assistant/sdk/guides/service/python/embed/install-sample

We should report this but I'm not sure how.

jiffyjaff avatar Mar 06 '22 05:03 jiffyjaff

Google support advised me to report the issue on Stack so I've done that. Still awaiting a response.

https://stackoverflow.com/questions/71385860/generating-credentials-auth-error-redirect-uri

jiffyjaff avatar Mar 09 '22 05:03 jiffyjaff

This is what i found so far not sure if I'm on the right path but here's what I got.

I think the issue is related to Making Google OAuth interactions safer by using more secure OAuth flows

1 2 3

techtom609 avatar Mar 09 '22 07:03 techtom609

Based on what you found, my guess is that this library is to blame ...

https://www.npmjs.com/package/google-auth-library

AR is using version 5.10 and the latest version is 7.14 which probably contains the OOB update that got blocked on Feb 28th 2022...

jiffyjaff avatar Mar 10 '22 04:03 jiffyjaff

shit well that really sucks I rely on AR for a shit load of automations. Plus the add-on isn't being updated anymore by the developer so not really sure what our next step here would be but you're right that change is most likely the issue.

techtom609 avatar Mar 10 '22 06:03 techtom609

I found a workaround for creating a new user. In my case, I needed to create a specific type of API credential. Here is what I did:

Create a new OAuth Client credential using the link below, ensuring the application type is "Web application" and set Authorized Redirect URIs to "http://localhost"

https://console.cloud.google.com/apis/credentials

Download the key, and create the user in the Assistant Relay appas you tried before. When it opens a new browser window to authorize the google account, you might need to bypass a warning. After you do this, a blank browser window will open but the address bar will contain the auth code you need. Grab the code from the relevant part of the URL here and paste it back into the Assistant Relay app:

http://localhost/?code=COPYCODEFROMHERE&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fassistant-sdk-prototype

Let me know if this works. I am successfully sending commands to the Assistant Relay server but nothing is playing on my speakers.

jiffyjaff avatar Mar 12 '22 18:03 jiffyjaff

@jdtoth Nice work! That approach worked for me. I started with a fresh install of Assistant Relay into Home Assistant then added the new OAuth credential and ran through the setup getting the auth code as you described. I used the built-in Sandbox to successfully turn on a light and also broadcast a message.

sourworm avatar Mar 12 '22 19:03 sourworm

WOOT WOOT WOOT!! IT WORKED!!! Fucking amazing workaround my man!!!! I cannot thank you enough for figuring that out!!! My smart home just wasn't the same without this feature and having it back just makes my fucking day!!!

techtom609 avatar Mar 12 '22 20:03 techtom609

@jdtoth It worked! Thank you!!! One thing to note: In the json credential file, I had to change {"web": to {"installed": for Assistant Relay to accept it. After doing that, it worked like a charm!

caj380 avatar Mar 13 '22 12:03 caj380

Hmm -- this is not working for me @jdtoth :/

joeyx22lm avatar Mar 16 '22 21:03 joeyx22lm

THANK YOU @jdtoth!!!

@joeyx22lm, the first time I tried this, it didn't work so I tried again and noticed that a "/" was being converted to "%2F" in the code. I changed the "%2F" back to a "/" and it worked. Is that maybe why yours isn't working?

To clarify, the beginning of my authorization code went from "4%2F0AX..." to "4/0AX..."

dotrooster avatar Mar 17 '22 17:03 dotrooster

Sadly this solution is not working anymore :(

catherineVoo avatar May 04 '22 13:05 catherineVoo

I found a workaround for creating a new user. In my case, I needed to create a specific type of API credential. Here is what I did:

Create a new OAuth Client credential using the link below, ensuring the application type is "Web application" and set Authorized Redirect URIs to "http://localhost"

https://console.cloud.google.com/apis/credentials

Download the key, and create the user in the Assistant Relay appas you tried before. When it opens a new browser window to authorize the google account, you might need to bypass a warning. After you do this, a blank browser window will open but the address bar will contain the auth code you need. Grab the code from the relevant part of the URL here and paste it back into the Assistant Relay app:

http://localhost/?code=COPYCODEFROMHERE&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fassistant-sdk-prototype

Let me know if this works. I am successfully sending commands to the Assistant Relay server but nothing is playing on my speakers.

This worked perfectly for me just now (May 10th, 2022)

jmpavlec avatar May 10 '22 08:05 jmpavlec

This worked perfectly for me just now (May 10th, 2022)

this worked for me as well, 7/31/2022

nerdyninny avatar Aug 01 '22 01:08 nerdyninny

FWIW I successfully got this working today (as the Home Assistant addon to be precise) using @jdtoth's workaround of grabbing the auth code from the browser URL bar.

I had the same issue as @caj380, just the other way around: my OAuth 2.0 Client ID was of type Desktop instead of Web Application, and I had to replace "installed" with "web" in the credentials JSON file to get Assistant Relay to display the Auth code input box.

Nephiel avatar Aug 04 '22 20:08 Nephiel