Nest Authorization Error Error 400: invalid_request

Getting Error 400: invalid_request after following the official integration docs (Nest - Home Assistant)

The good news is I just went through the steps @JamesDeng outlined for Web Auth, and it worked! I did recreate a new project in the device access console to avoid the client ID mismatch issue that might happen.

image

Bam! This one solved it for me. Thank you!

Glad that worked. Somehow it stopped working for me. I ended up setting up a new ā€œWeb Applicationā€ app and grabbing the ā€œcodeā€ from the url when the reauth fails. I have to do that every 7 or 10 days. Not the end of the world. I hope this gets fixed permanently.

@kg23 Iā€™m having issues setting up the Nest integration. It appears to be failing during reauthentication, so Iā€™m wondering what you mean WRT the ā€œcodeā€ from the url?

When my ā€œDesktop Applicationā€ integration expires (every 7 or 10 days), I go through the re-auth steps in HA. Eventually it fails b/c my HA installation isnā€™t exposed to the internet for the OAuth response. At that point there is a code parameter in the URL. I paste that into the HA Nest auth form.

I got this error trying to do as you mentioned.

Error 400: redirect_uri_mismatch
The redirect URI in the request, urn:ietf:wg:oauth:2.0:oob, can only be used by a Client ID for native application. It is not allowed for the WEB client type. You can create a Client ID for native application at https://console.developers.google.com/apis/credentials/oauthclient

Iā€™m not the best at explaining what I did, but here goes. Hope it can help.

What worked for me but do require Cloud:
I logged into ā€œGoogle Homeā€ on my phone, and made sure my cameras and thermostat were available there. I also configured a new entity in the Google Home app and searched for Home Assistant. Added it, logged into my Nabu Casa account and made sure i was connected.
I ended up subscribing to the Home Assistant Cloud with the Nabu Casa account. Made sure to log into my Home Assistant remotely first in a different browser tab.
I followed every step as per the current Nest Integration when integrating the app in HA.

After failing with the OAuth for App when integrating Nest, I ended up testing OAuth for Web Web App instead of the Desktop App, but got the same error - only the URI redirect link was with my Nabu Casa account link for my Home Assistant.

In a different tab, I kept the Google Could Console credentials page open (under APIā€™s & Services). I then added under ā€œAuthorized redirect URIsā€ the same URI i got in the ā€œERROR 400: URIā€ message that is located at the very bottom of the error message XXXXXXXXXX.ui.nabu.casa/auth/external/callback. (You might have to press that ā€œdownā€ arrow in the error message.

Replace the XXXX with the address you have and paste it.

Hit ā€œSAVEā€ for the credentials - and boom. I was finally allowed to finish the remaning steps from the original instructions as seen below from the original instructions.

Magic happened and after several hours of failing.
But tbh, screw Google with their sensitive approach to it allā€¦ Just make it native cloudless. I might end up changing devices because I want to be free from any cloudservice. But for now, I just want it working untill I decide to invest differently.

2 Likes

Hi there, sorry for the question a bit OT, but is there anybody facing issue paying the Device Access Fee of 5$???
I am asking because it seems that the snippet that required the payment is not compliant with the new PSD2 payment autorization in Europe and therefore I am not even abble to go further with the device access registrationā€¦
Iā€™ve asked different friends with their own google account and they are all facing the same issue ad the check-outā€¦
Google support on this is demanded to stack overflowā€¦and nobady seems to be aware of the problem.

once again thanks for any help!

Thanks for that. Gives me hope!

Thanks @abigmoocow for your tip about the URI - that got me over the finish line, along with not needing to expose Home Assistant to the internet. That meant all I had to do was get a free domain + ssl certificate, which I got from DNSExit.com, and it looks like I only needed https for the authorization step - no need to automate the certificate renewal since I can go back to http now. Everything still works internally without https once authorized (and no internet forwarding of course).

FYI I ā€œsolvedā€ this by determining that my camera was off :man_facepalming:

Turning it back on made it work immediately. Now to figure out how to turn it on/off in HA.

after trying a few of these, I was able to fix it by adding this url h ttps://my.home-assistant.io/redirect/oauth

under ā€œAuthorized redirect URIsā€ on the project Credential page: https://console.cloud.google.com/apis/credentials?project=XXXXXX (XXXXXX = project name)

1 Like

Awesome, finally something that works, thnx!!