DuckDNS domain for Google Nest integration URI in 2024?

TLDR: How do I use my Duckdns domain for the Google Nest integration URI redirect?

I got HA exposed to the internet with its own internal and external domain from Duckdns and Let’s Encrypt: https://randomdomain.duckdns.org and ports 443 and 8123forwarded. I can see the “Connection Secure” window both on and off my network. Using this I got Google Home set up and I can now see all my HA devices in Google Home on my mobile device.

I now want to set up Google Nest to my HA using the integration for my camera and thermostat but I am hard stuck at the “Link to account phase,” due to the URI redirect not working.

The https://my.home-assistant.io/redirect/oauth returns the Error 400: redirect_uri_mismatch.

If I use the </auth/external/callback> at the end of my Duckdns domain I get the Error 400: invalid_request

I have spent hours on Google and reading posts on here that are 5+ years old trying to figure this out and I am at a loss. Any Ideas on what I am missing or a solution to this?

Solution note: If you are using a Duckdns+Lets Encrypt, before Adding NGINX to the mix, try making your Authorized redirect URI in the Google Cloud Console Credentials section look like this:
https://yourdomain.duckdns.org:443/auth/external/callback

If you still get either 400 error. Set up and configure the NGINX server to HA (there is a quick 10min video walk through) and then try it again with the above URI with port 443 added after your domain.

Sounds like you need a reversed proxy, so that internal requests like https://my.home-assistant.io/redirect/oauth will end up at HA (local address), and not your router(external address) :wink:

Have a look at NGinX

Thank you! I knew there was something I didnt install this time around.

I have done about 3 clean installs this week as trial runs before I am ready to commit to leaving smart things as my main setup and of those times I did have NGinX running… just can’t remember what it was for. :sweat_smile:

After setting up NGinX, should I still be using the:
https://my.home-assistant.io/redirect/oauth
or
https://randomdomain.duckdns.org/auth/external/callback
for the Google URI?

NGinX would allow your URI to connect to your internal address, so that would be the latter: