Nest Authorization Error Error 400: invalid_request

Can you tell me how to generate a new access token/authorisation code please ? At the moment I am deleting the old project and starting from the beginning each time.

When HA says there is a problem, Set your Google Cloud Console project back to testing and go through the reauth process through HA. Then set back to Publish. You have to wait for HA to say there is a problem. I find that changing my Nest temp will trigger the reauth in HA.

1 Like

And now my steps above are no longer working. I get “Unknown error occurred”

Thank you @JamesDeng!! Your instructions worked for me.

Question: For Nabu Casa users, where do we find the unique external url? In the Mobile Home Assistant Companion, under External URL, it just says “Home Assistant Cloud” (see screenshot).

I’m assuming I need to insert something unique, where the “xxx” are in the example template url here:

https://xxx.ui.nabu.casa/auth/external/callback

Found it. Was looking in the wrong place. For anyone else, it’s under the Home Assistant Cloud section… right where it should be (screenshot included).

JamesDeng. Thank u! This worked for me.

Hi All, I’m trying the custom component version of this hack, and finding that my climate entities (but not the temperature and humidity entities) for my thermostats are missing. Any idea why??

UPDATE: following Shane’s comment below, I’ve updated the ghclone command to clone the master rather than dev branch. After this, the climate entities work once again.

Where what I did:

  1. Cloned the nest integration as a custom component
cd config/custom_components
pip install github-clone
ghclone https://github.com/home-assistant/core/tree/master/homeassistant/components/nest
  1. Then I edited the const.py file, AND added a version field to the manifest.json file. Without the latter edit, the custom component was not recognized. It’s not enough to copy the core integration, you MUST add a version field.

  2. Restarted HA and installed the new (overridden, custom) nest component.

  3. Copied out the code string from the resulting URL.

As a result, my temperature and humidity entities work, but my climate entities do not. So I can see the temperatures, but I can’t adjust the thermostat. :confused:

Any ideas what might be going on?

1 Like

Could you help me with the field in create subscription “create a cloud sub/pub topic”? It’s saying to take it from the device access page, but doesn’t make sense to me with the format it requires. The example links are dead. Thank you in advance.

Thank you so much finally got it to work with your instructions and some additional changes!!!

@JamesDeng Thank you for these detailed instructions. I was getting “404 invalid_request” errors authenticating with the Desktop App OAuth method, but your walk-through using the Web App allowed me to get the Nest integration working in Home Assistant.

I tried adding the version field. This actually got me closer than ever before to getting this integration to work, as now the URL has the “http://localhost:1” in it, however when I paste the code from the URL, it loads for much longer than before but still gives me the Unknown Error. Is there anything I could be doing wrong here? I’ll keep trying different things.

@danhiking I made an account just to post this.

I found myself in the same place you were, working connection through the localhost work-around, but only humidity and temperature entities viable, no climate entity.

After reading through some logs I noticed some odd error messages, of why the climate entity couldnt be setup, almost as if it was using the wrong file path to start it.

I believe this PR’s usage of EntityFeature enums combined with our usage of custom_components, causes problems. However that’s only my working theory

But I did get the climate working and can now control the temperature !!

I followed all your same steps in your post, however I cloned the “master” branch vs the “dev” branch that you cloned for the nest component.

Thought I would share for you and others ! Hopes this helps !

I was able to get this component installed fine. However, when I go to “configure” the resulting redirect page is still a google auth error page with a “Error 400: redirect_uri_mismatch”:

If you’re the app developer, make sure that these request details comply with Google policies.

* redirect_uri: http://localhost:1

The URL does not contain a code parameter either. Any ideas what I have done incorrectly here?

worked perfectly for me! Thank you very much!!! :+1:

Thanks Shane, your insight worked!

Do you think:

  1. the PR is eventually going to go in and cause a problem in master?
  2. this problem only arises in the custom_component?

In the meantime I’ll edit the post above in case it helps someone else.

Hi Travis,

That error looks correct, but do you see a bunch of query params after the localhost:1…? You’ll need to dissect the URI to find the ...&code=...&... argument. I don’t have a screenshot handy.

Unfortunately there is no ‘code’ param, that is my issue.

I only have the following 2 params:

authError=...,client_id=...

My old nest api method was working fine but figured now was a good time to migrate to the “new” method. What a stupid mistake that was… doesn’t look like these workarounds are working anymore either.

I don’t get the &code= part in my URL when changing the const.py file. I’ve tried configuring the web app method using the old instructions but the “Go to url here (unsafe)” link goes to https://accounts.google.com/# and gives me a Something went wrong. Please try again. message.

So now I have no nest integration and no way to go back to the older, working method

1 Like

Hello
Just trying to set up the nest integration and getting the Nest Authorization Error Error 400 :frowning:

Where is the issue?
Is it with Home Assistant or with Google?
It would seem to me that the Nest HA integration needs to be, not necessarily fixed but changed to work with Google’s changes… but I’m only guessing as I’m quite the noob :slight_smile:

And is the workaround not working? as per @ideasman69 is saying?
I’d rather not spend time trying to get the workaround working for it to be dead in the water!