Withings Intgration - Doesn't work

Hi,
Have been struggling to get the Withings itergration to work.

I have followed steps in the docs here - Withings - Home Assistant

But when i add the integration - i get the error

{“errors”:[{“message”:“redirect_uri_mismatch: The redirect URI provided is missing or does not match partner callback url”}]}

I have set up the Withings Dev account and completed all steps

The Dev account asks for a Registered URL. I have tried the following but always get the same error.

(my Nubu Casa URL is changed for privacy

https://XXXXXXXmjx2zx.ui.nabu.casa/hass/auth_callback
https://XXXXXXXmjx2zx.ui.nabu.casa/auth/external/callback
https://XXXXXXXmjx2zx.ui.nabu.casa

Both of these return an error on the Withings Dev portal page when i click test

Our servers couldn’t reach this URL:
Partner error: Host Unreachable

I also tried the URL mentioned in the HA Docs

This doesn’t return a error when tested on the Withings site, but still gives me the same error when i try to add the Withings Integration - I do have my: added to configuration.yaml

I am running HA in Docker and havea Nubu Casa subscription

Thanks in advance
Scott

Make sure when you auth you’re connected to the same front end as your OAUTH URL. For instance if you used Nabu Casa as your URL, you need to be logged into Lovelace using Nabu Casa so your source URL will match when you attempt to do the auth or it will fail. (I usually connect to my instance by IP when at home to avoid the round trip, this particular issue drove me NUTS until I logged into my Nabu Casa URL and it magically worked.

I’ve had the same issue for the past couple months. Prior to that I had been using this intergration for several year. I’ve had no changes. I do not use nabu casa. I just assumed there was a bug, but have not cared enough to look further, I am now on 2023.1.1 and still have the problem.

1 Like

Thanks for the reply.
I did try this just now

  1. Logged into HA through my nabu case url
  2. Created a new app in the the Withings Dev portal. Copied Client ID/Secret
  3. In HA added the integration, it ased to create user Credentials, then I received the the Allow thie App page fro Withings ( this we new progress)
  4. Clicka Allow app and ended up with the Browser error

{“errors”:[{“message”:“redirect_uri_mismatch: The redirect URI provided is missing or does not match partner callback url”}]}

I did notice the url had my.homeassistante inthe URL string, I replaced this with https://XXXXXXXXu9wgmjx2zx.ui.nabu.casa/auth/external/callback ( with my actual url)

I received the ![Screenshot 2023-01-08 at 6.14.15 pm|690x166]
Withings Page requesting access again, Click allow. It then went to HA Integration screen with a Error Box in the middle ( see attached)

(upload://8wLizJpa8oMDDJLSWlM5NlZIMDd.png)
Checked log file

Logger: aiohttp.server
Source: helpers/config_entry_oauth2_flow.py:309
First occurred: January 7, 2023 at 12:27:12 PM (2 occurrences)
Last logged: 6:09:54 PM

Error handling request
Traceback (most recent call last):
File “/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py”, line 435, 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 60, in security_filter_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/forwarded.py”, line 94, 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 81, in ban_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/auth.py”, line 236, in auth_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/view.py”, line 136, 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 286, in async_configure
result = await self._async_handle_step(
File “/usr/src/homeassistant/homeassistant/data_entry_flow.py”, line 374, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
File “/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py”, line 309, in async_step_creation
token[“expires_in”] = int(token[“expires_in”])
KeyError: ‘expires_in’

Integration not added

Any ideas???

I don’t use Nabu Casa, I use nginx in front of my installation, but my integration broke a little while back. Went to the Withings dev portal, changed the URL in the app as follows and everything was up and running and I’ve had zero issues since.

I thought for a few minutes that the https://my-home-assistant.io URL was a placeholder example so I tried with my own URL.

1 Like

After having the same issues with:

{“errors”:[{“message”:“redirect_uri_mismatch: The redirect URI provided is missing or does not match partner callback url”}]}

What worked for me to get the integration configured:

  1. On the Withings site create an integration with redirect URI: Link to OAuth2 Authorize Callback – My Home Assistant
  2. Open your HA via https://my.home-assistant.io/ (not via the Nabu Casa url, not via the local (IP) URL)
  3. Add the integration steps

Have not tested if it actually works.

I updated my.home-assistant.io to use my nabu case url

I added Oauth2 callback using my.home-assistant url to the Withings dev portal.

Logged in into HA using the Nabu casa url. When adding the integration, I get to the Withings approve app screen, but clicking authorise gives me the same error

{“errors”:[{“message”:“redirect_uri_mismatch: The redirect URI provided is missing or does not match partner callback url”}]}

Repeated the process using my internal HA address, same problem.

I think this integration is broken or Withings have changed something recently

1 Like

I’ve started having this error after years of working too.

I have this issue, too, starting today. I’m running Home Assistant 2023.1.7

same problem here

All of a sudden, it’s working. I may have restarted HA once or twice, but can’t think of what else would have fixed things.

Just ran into this issue today, but only with 1 of my users.
added My: to my configuration.yaml, changed the callback URL in the withings dev portal to Link to OAuth2 Authorize Callback – My Home Assistant and rebooted HA. It’s now showing as connected again even though I didn’t re-authenticate.

I used to have to re-authenticate a few times per week and haven’t had to do so in a good 6 months or so until now. I’m not confident changing the URL will fix this.

Sounds good, but when I go to Link to OAuth2 Authorize Callback.
What should I select there. I tried some different. Including Integration by brand.
Then when checking the Callback URL i Withings Dev Dashboard. I stop recieving the message
" Our servers couldn’t reach this URL:
Partner error: Host Unreachable"
But I still get the same error when tying to connect.
{“errors”:[{“message”:“redirect_uri_mismatch: The redirect URI provided is missing or does not match partner callback url”}]}

And when I try to connect to my HA via https://my.home-assistant.io/ I’m asked open the link to my NabuCasa account. And thats where I start the add integration.

I’m fed up with this not working anymore. How do I remove the Withings integration completely. I don’t see an option except to hide it.

edit: can’t even hide it!

Hello,

I had this problem, too. Restarting the HA helped!

Cheers.

OK, I gave up and deleted everything in HA.
I then deleted the everything in Withings Developer Dashboard
And I removed the credetials

I thought I should start over…

I created a new a new application

I followed the guide at
https://www.home-assistant.io/integrations/withings

But I still can’t get it to work again…

I’m using NabuCasa, and I did use the link…

This is the error message I get

Logger: homeassistant.config_entries
Source: helpers/network.py:200
First occurred: 01:56:15 (3 occurrences)
Last logged: 02:08:57

Error setting up entry Peter for withings
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 383, in async_setup
result = await component.async_setup_entry(hass, self)
File “/usr/src/homeassistant/homeassistant/components/withings/init.py”, line 130, in async_setup_entry
data_manager = await async_get_data_manager(hass, entry)
File “/usr/src/homeassistant/homeassistant/components/withings/common.py”, line 647, in async_get_data_manager
url=webhook.async_generate_url(
File “/usr/src/homeassistant/homeassistant/components/webhook/init.py”, line 75, in async_generate_url
get_url(hass, prefer_external=True, allow_cloud=False),
File “/usr/src/homeassistant/homeassistant/helpers/network.py”, line 200, in get_url
raise NoURLAvailableError
homeassistant.helpers.network.NoURLAvailableError

Anyone got any ideas?

I have this issue, too. Started with the 2023.5.2 update. I skipped 0 and 1. Couldn’t find a solution in the forums so I opened a ticket with Nabu Casa. No reply yet.

@pethson

One last edit, which worked for me:

Withings dev app registered URL: https://my.homeassistant.io/redirect/oauth
it fails their “Test” every time, which wasted A LOT of my time

My Home Assistant service URL: the Nabu Casa link

Does this still dont work?

I cant get this to work.
Ive tried the my.homassistant address and the nabu casa address. It just wont connect. Restarted several times and adjusted.
Why does it work for some, and not others?