Nest integration Access Token failure

Was working perfectly up to today, now broken…

Any ideas ?, the integration is so horrifically complicated I wouldn’t know where to start…

1 Like

Hi. For some reason your access token was revoked by Google. There are a couple options:

  1. Just fix it approach. If you are running the latest version of home assistant, then you should be able to restart and get sent to the “reauth” flow to reauthorize your account. Click through and re-authorize and you should be on your way.
  2. Debug it approach. In https://github.com/home-assistant/core/issues/44584 I added extra debugging to help you get the response from Google as to why your auth was failing. You can turn up debug logging for that package and see the error . Most likely it is failing due to invalid_grant which you can read more about root causes here: https://blog.timekit.io/google-oauth-invalid-grant-nightmare-and-how-to-fix-it-9f4efaf1da35 where the most common is changing your password, but there are others as well. This isn’t really a home assistant issue, but something about the state of your account.

This can happen for a variety of reasons, related to your account.

1 Like

FWIW I had the same thing happen to me today… Was working great then out of the blue it wouldn’t accept my token. While I did end up getting it fixed, a restart didn’t do it for me (albeit I’m not on the latest version of HA like Allen suggested above).

I started by logging into the Google APIs dashboard and generating a new token which I then copied into my configuration.yaml, but that didn’t do the trick (at least not by itself).

I removed the integration in HA, then re-added it. After that started working again for me.

I restarted and then got a notification to re-authenticate. At the end of the process I got a Server Error 500 message, however the thermostats are now working again.

Hi. I have this same issue every week or so now. Do we already know why the authentication is required again? Is there some time-out validity to this authentication option?

Would love to know! And now I’m looking for a automation to get trigger that the integration has failed. Because I don’t get the notification from HassIO while running…

1 Like

This problem should not be marked as solved; I continue to have this problem on a recurring basis.

The problem seems to be that the oauth consent page is set to Testing rather than Production. Change that setting in the Google cloud console and you should be good to go.

When set to Testing, apparently you only get a refresh token valid for 7 days.

1 Like

Hello Allen,

Just activated that using this button:
image
Lets see if it works for me. Thanks for this tip!

Thanks for your comment. I wonder if that’s the solution!

However, when I want to set it to Production this warming pops up “Your app will be available to any user with a Google Account.”

This is rather frightening, although I might miss-interpret it. Could you elaborate on this? Would it be possible for any random Google-user to control my Nest thermostat with that setting as Production?

You can read more about it here: https://support.google.com/cloud/answer/10311615?hl=en#zippy=%2Cin-production

To make the nest API work with home assistant, you are setting up a developer workflow as if Home Assistant is an app wanting to access your account. So this warning means you can now let your home assistant app access to other users accounts via this flow. However, the way your SDM project is configured is tied to only your account, so even that can’t really happen unless you are a Commercial Development partner.

(The step that gives an app access to your devices is when you go through the authorization flow and grant access, the page with all the toggles.)

For specific instructructions in the current documentation, see the Configuration section, “Configure OAurh Consent Screen [Cloud Console]” subsection. The critical change is step 7: “In Production” rather than testing.

1 Like

I struggled finding how to change the app from Testing to Production, so here are the steps and a screenshot in case it helps someone else.

  1. Visit Google Cloud console https://console.cloud.google.com
  2. You most likely have one project so it will default to that one. If not, then select your Project.
  3. Select “APIs & Services”
  4. Then Select OAuth consent screen
  5. Here you can change from Testing to Production

Reauthentication issue