core: Withings Callback URL must be both publically accessible AND your HA environment
Home Assistant release with the issue:
0.99.3
Last working Home Assistant release (if known): N/A
Operating environment (Hass.io/Docker/Windows/etc.):
Hass.io in Docker on Ubuntu
Component/platform:
withings platform integration
Description of problem: When establishing your Withings Application for integration you must specific a “Callback URL”. That callback URL will be validated by Withings as accessible (So you cannot use RFC1918 IP addresses, localhost, etc.)
When authorizing HA with the Withings Integration, you are redirected to Withing’s site to authorize the application. Upon selecting your profile, you will then receive an error from withings that the URL does not match:
{“errors”:[{“message”:“redirect_uri_mismatch: The redirect URI provided is missing or does not match partner callback url”}]}
This prevents the Integration from being authorized and the documentation states that if this happens you should: " Note: If you get a browser error saying the site is inaccessible, you can modify the http://domain portion of the URL to something you know is accessible, locally or publically. For example, http://localhost:8123. " However, “localhost:8123” will not pass the Withing’s validity test and cannot be used. You also cannot use a local, RFC1918 IP, address either.
Problem-relevant configuration.yaml
entries and (fill out even if it seems unimportant):
Traceback (if applicable):
{"errors":[{"message":"redirect_uri_mismatch: The redirect URI provided is missing or does not match partner callback url"}]}
Additional information:
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 31 (9 by maintainers)
I struggled a bit to get it working, but somehow after changing the callback URL in Withings developer settings to start with exactly the same as the base URL and some refreshing later is suddenly went trough.
Had to include the port, 443 in the Withings URL!
I today had issues connecting a withings account to Home Assistent. After reading all comments I copied the exact url that was in the “internal URL” field with “auth/external/callback” added to the end, into the url-field in the withings API settings.
This was in my case something like “http://myservername.local:8123/auth/external/callback” where this part “http://myservername.local:8123/” was in the internal URL field in the HASS settings. It complies in no way to the Withings callback URL criteria since it has no SSL, contains another port than 80 or 443 and is unreachable from the internet…
When leaving the Withings API connection in the Dev (and not Prod) setting Withings will accept that URL.
Added the next bits to the configuration.yaml
and it worked like a charm. I had to add the last line with ‘profiles:’ else HASS indicated my config was incorrect.
Hope this helps others struggling with this connection.
You need to edit your app in https://account.withings.com/partner/edit_oauth2 and set the callback url to: https://foobar.ui.nabu.casa/api where foobar is your unique nubacasa url. Then set the base_url to the same but without the api at the end. This seems to redirect things correctly back to the instance having authenticated but then I get a 500 error from the ha server.