Unable to complete Withings integration — "Error while obtaining access token" despite seemingly correct setup

Hi everyone,

I’ve been struggling (with the help of ChatGPT) for days to get the Withings integration working in Home Assistant without Nabu Casa, using my own reverse proxy (Nginx) and Let’s Encrypt SSL certificates. I’ve followed all the guidance I can find (in particular the post “Struggling to get Withings integrations fully operational” was very helpful). I believe I’ve done everything correctly — but I currently get stuck at this point:

“Error while obtaining access token” popup after completing the OAuth login flow.


:white_check_mark: My setup

  • HA: Home Assistant container (image: homeassistant/home-assistant:stable) running in Docker on Ubuntu Server 24.04 on a Raspberry Pi 4
  • Reverse proxy: Nginx with valid Let’s Encrypt certificates
  • External URL: https://<mydomain>.duckdns.org (public and reachable)
  • my: is configured and points correctly to this external URL
  • I have no other integrations that use OAuth or external callbacks
  • System time is correct and synced via NTP

:white_check_mark: Withings Developer Portal

  • App registered with:

    • Callback URL: https://my.home-assistant.io/redirect/oauth
    • App interface: Public API integration
  • Application credentials copied exactly into HA (double-click copied from text editor and making sure everything was copied and there were no extra spaces)


:white_check_mark: Home Assistant configuration

In configuration.yaml:

homeassistant:
  external_url: "https://<mydomain>.duckdns.org"
  internal_url: "http://homeassistant:8123"

# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

my:

withings:
  use_webhook: true

logger:
  default: info
  logs:
    homeassistant.components.withings: debug

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 172.22.0.0/16  # My container network between HA and nginx

Reverse proxy is configured to handle SSL via Let’s Encrypt and certificates are created and valid.


:test_tube: What happens

  1. I initiate the Withings integration from HA
  2. I’m redirected via my.home-assistant.io to the Withings OAuth flow
  3. I log in, grant permission, and the browser tab closes
  4. HA switches from “Open Website” to:

“Error while obtaining access token”

No redirect_uri_mismatch anymore, so that part seems to work now.
However, the integration never completes due to the Error while obtaining access token. It is simply not visible among the installed integrations and there is never a web hook call that I can find.


:pushpin: Additional notes

  • Examining the container logs didn’t give anything useful. Nothing related to withings…
  • I don’t see any Withings entry in .storage/core.config_entries, so I can’t manually register a webhook via UUID
  • There’s a Repair entry in HA UI with the withings logo:

“homeassistant: config_entry_only”

Not sure if that’s related


:bulb: What I’m looking for

  • Ideas for further debugging
  • Explanation of what can cause “Error while obtaining access token”
  • Confirmation from anyone who got this working with:
    • Reverse proxy
    • DuckDNS
    • No Nabu Casa
  • Is it expected that no entry appears in core.config_entries when auth fails like this?

Thanks in advance — I’d love to get this working just to trigger automations from the in_bed sensor. Happy to provide logs or diagnostics if needed.

     /Daniel