core: Reconfigure error 500

The problem

The withings integration setup with webhook was working fine for a few days until it asked me to reconfigure.

I go through the documented steps to reauthorize the integration in the dev env of withings and it get to the link account screen upon authorizing.

After clicking “Link Account” I get an Error popup on my HomeAssistant page with no message body. If I click reconfigure again I am prompted by a 500 internal server error message.

I am at this point also unable to delete the integration as per my last screenshot.

image

image

image

image

image

What version of Home Assistant Core has the issue?

core-2023.03.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

home assistant supervised

Integration causing the issue

Withings

Link to integration documentation on our website

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

Diagnostics information

Screenshots of flow attached

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: aiohttp.server
Source: helpers/config_entry_oauth2_flow.py:324
First occurred: 10:24:31 PM (2 occurrences)
Last logged: 10:24:56 PM
Error handling request

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.10/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 67, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 227, 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 80, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 235, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 146, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 171, in get
    return await super().get(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 96, in get
    result = await self._flow_mgr.async_configure(flow_id)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 271, in async_configure
    result = await self._async_handle_step(
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 367, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 324, in async_step_creation
    token["expires_in"] = int(token["expires_in"])
KeyError: 'expires_in'

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 16 (3 by maintainers)

Most upvoted comments

I also have this issue!

I was able to delete the Integration somehow, but now when adding it again, it skips the OAuth credentials popup and goes directly to the “open website” prompt. When clicking the link and approving the application, linking my HA install, and going back to HA, I get the 400: internal server error.

I have Nabu Casa, and it must be set up correctly in terms of outside connection to to my HA install because TTS with Google devices works just fine.

I have got this working now by: go into the withings developer portal https://developer.withings.com/dashboard/

Edit your application

Add another callback URL: https://my.home-assistant.io/redirect/oauth imageSave and then Reconfigure again