"Error while obtaining access token." when setting up Google Nest integration

I’ve followed all the Google Nest integration setup steps multiple times and I get this error every time at the very last step (after it opens the Google page and you sign in and Link accounts): “Error while obtaining access token.”

I’m running this on a Raspberry Pi 4 B as a Docker container. I got it working before when running Home Assistant OS as a VM on a Windows host.

Here is a screenshot of the error:

It happens right after this page:

Is your homeassistant using http or https ? Confirm the correct url.

Disable addblockers, script blockers, dns blockers

If you are subscribed to nabu casa, try the url for that.

It’s using plain http. I copy/pasted the URL in my browser so should be the right one.

I tried again in a private Firefox window and disabled my adblockers, but still no luck.

I noticed a failed request from the network debugger after clicking “Link account”. It says “oauth_failed”:

GET http://raspberrypi.local:8123/api/config/config_entries/flow/de9f3498972f989ef62c65c29e3d02d9

JSON Response:
{“type”:“abort”,“flow_id”:“de9f3498972f989ef62c65c29e3d02d9”,“handler”:“nest”,“reason”:“oauth_failed”,“description_placeholders”:null}

Did you ever get to the bottom of this? I’m having the same issue but against my xxx.duckdns.org version of the url. I’ve followed various setup instructions for Nest to the letter and none of them work.

It worked after upgrading the Home Assistant Docker image from 2024.1.6 to 2024.2.2. I was actually using the latest tag, which was pointing to 2024.1.6, so I had to explicitly set the tag.

I deleted my Nest credentials and then did the setup again exactly as before, reusing my Google Project ID and Device Access Project ID, and it just worked.