core: Nest authentication fails 'unknown error occured'

The problem

I am trying to add a nest intergration to Home Assistant by following this guide: https://www.home-assistant.io/integrations/nest

I have followed the guide word by word and got to the Device Setup > OAuth and Device Authorization steps Here I have to add the nest integration and authorize my google account. I accept my Oauth screen, and enter the access code that is provided by the Oauth. Then the screen will just keep on loading and eventually stop with the error: “unknown error occured”:

image

I have tried to guide multiple times to make sure I didn’t mess up. I also have verified if my nest account is a google account (it is) and I don’t have any weird constructions with multiple homes (I used to but removed them as I read that sometimes that messes things up)

I am able to follow: https://developers.google.com/nest/device-access/authorize#modify_account_permissions which used a web server call, but the API works which means my SDM API is working.

Following that guide also resulted in my GCP to have a partner connection with nest (which is a good thing, I think?) which I can view from: https://nestservices.google.com/partnerconnections

What version of Home Assistant Core has the issue?

core-2021.12.7

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

nest

Link to integration documentation on our website

https://www.home-assistant.io/integrations/nest

Example YAML snippet

nest:
  client_id: 85(omitted).apps.googleusercontent.com
  client_secret: GOC(omitted)
  # "Project ID" in the Device Access Console (not Cloud Project ID!)
  project_id: ce3(omitted)

Anything in the logs that might be useful for us?

No response

Additional information

The authentication call being made that keeps pending and fails is: http://homeassistant.local:8123/api/config/config_entries/flow/b44c184ddc35495db35063e28c2cf180

It has a payload of: {“code”:“4/(omitted access token)”}

In the console (Google Chrome) it gives the error: Failed to load resource: the server responded with a status of 504 (Gateway Timeout) POST http://homeassistant.local:8123/api/config/config_entries/flow/b44c184ddc35495db35063e28c2cf180 504 (Gateway Timeout)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 40 (19 by maintainers)

Most upvoted comments

I am having this issue. Running core-2022.2.6 in docker and I haven’t disable ipv6, but am able to ping ‘google.com’ from my HA container.

below is my log dump.

`Logger: aiohttp.server Source: helpers/config_entry_oauth2_flow.py:201 First occurred: 2:49:55 PM (1 occurrences) Last logged: 2:49:55 PM

Error handling request Traceback (most recent call last): File “/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py”, line 435, in _handle_request resp = await request_handler(request) File “/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py”, line 504, in _handle resp = await handler(request) File “/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py”, line 117, in impl return await handler(request) File “/usr/src/homeassistant/homeassistant/components/http/security_filter.py”, line 60, in security_filter_middleware return await handler(request) File “/usr/src/homeassistant/homeassistant/components/http/forwarded.py”, line 220, in forwarded_middleware return await handler(request) File “/usr/src/homeassistant/homeassistant/components/http/request_context.py”, line 28, in request_context_middleware return await handler(request) File “/usr/src/homeassistant/homeassistant/components/http/ban.py”, line 79, in ban_middleware return await handler(request) File “/usr/src/homeassistant/homeassistant/components/http/auth.py”, line 219, in auth_middleware return await handler(request) File “/usr/src/homeassistant/homeassistant/components/http/view.py”, line 137, in handle result = await result File “/usr/src/homeassistant/homeassistant/components/config/config_entries.py”, line 164, in post return await super().post(request, flow_id) File “/usr/src/homeassistant/homeassistant/components/http/data_validator.py”, line 62, in wrapper result = await method(view, request, *args, **kwargs) File “/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py”, line 111, in post result = await self._flow_mgr.async_configure(flow_id, data) File “/usr/src/homeassistant/homeassistant/data_entry_flow.py”, line 252, in async_configure result = await self._async_handle_step(flow, cur_step[“step_id”], user_input) File “/usr/src/homeassistant/homeassistant/data_entry_flow.py”, line 325, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) File “/usr/src/homeassistant/homeassistant/components/nest/config_flow.py”, line 277, in async_step_auth return await super().async_step_creation(user_input) File “/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py”, line 293, in async_step_creation token = await self.flow_impl.async_resolve_external_data(self.external_data) File “/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py”, line 165, in async_resolve_external_data return await self._token_request( File “/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py”, line 201, in _token_request resp.raise_for_status() File “/usr/local/lib/python3.9/site-packages/aiohttp/client_reqrep.py”, line 1004, in raise_for_status raise ClientResponseError( aiohttp.client_exceptions.ClientResponseError: 401, message=‘Unauthorized’, url=URL(‘https://www.googleapis.com/oauth2/v4/token’) `