home-assistant.io icon indicating copy to clipboard operation
home-assistant.io copied to clipboard

Redirect URI must be publicly reachable address to HA

Open magicus opened this issue 2 years ago • 4 comments

Feedback

The documentation seem to be incorrect. I followed the instructions but only got

{
  "error": "unauthorized_client",
  "error_description": "client or redirection URI not authorized",
  "state": "..."
}

Many people have reported similar problems.

The solution turned out to be not to use an internal URL, but instead https://<my.external.address>:8123/auth/external/callback. Now everything worked.

URL

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

Version

2022.8.7

Additional information

No response

magicus avatar Sep 06 '22 08:09 magicus

Hey there @davidmstraub, mind taking a look at this feedback as it has been labeled with an integration (home_connect) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

The documentation doesn't state you should use an internal address. It states

The <HOME_ASSISTANT_URL> must be the same as used during the configuration/ authentication process.

And in your case, this was apparently the external URL.

DavidMStraub avatar Sep 06 '22 09:09 DavidMStraub

So which "configuration/authentication process" is this refering to? Some process in HA or in Home Connect?

Also, I should probably add that I started out by setting "https://my.home-assistant.io/redirect/oauth" as the URI, as described in the documentation. This did not work, either. I have not disabled My Home Assistant.

It was only after trying all kinds of debugging, and searching the web, that I finally tested to enter the public URL, and got it to work. And my discovery matched several forum posts etc, which just claimed "the official documentation is incorrect".

But if you claim that the documentation is correct and this should work, then there might be a bug in the home-connect integration instead. It just seemed to me to be home connect telling us that it did not accept the URL ("client or redirection URI not authorized"), so I assumed something had changed on their part.

magicus avatar Sep 06 '22 11:09 magicus

@DavidMStraub What is this "configuration/ authentication process" that the documentation is referring to?

magicus avatar Sep 15 '22 19:09 magicus

so I followed the same steps, used my internal IP, and now HA is stuck in trying to connect to : https://api.home-connect.com/security/oauth/authorize?response_type...................: Starting a new integration won't work, as it is trying to connect everytime with the wrong credentials. any idea's how to start over again in HA?

Remc000tje avatar Oct 14 '22 12:10 Remc000tje

so I followed the same steps, used my internal IP, and now HA is stuck in trying to connect to : https://api.home-connect.com/security/oauth/authorize?response_type...................: Starting a new integration won't work, as it is trying to connect everytime with the wrong credentials. any idea's how to start over again in HA?

Just remove your Credentials (top right three dots) and you can reenter your ClientID and Secret...

But i think that the Integrations is not working at the moment... I've tried any tip here, but no success!

it doenst matter which url you put into home connect, the first browser window opens always with: &redirect_uri=https://my.home-assistant.io/redirect/oauth&state=

after trying to change that value, it went a step further and i could login but after the last "allow" button, HA says Error and nothing more!

if i let it go with the default redirect it fails with "error": "unauthorized_client", "error_description": "client or redirection URI not authorized",

DarthDestroyer avatar Oct 14 '22 21:10 DarthDestroyer

I am having exactly same issue. My setup is home assistant hosted inside kubernetes (docker container) behind NGINX with my domain assigned and certificate working. I am getting redirected to my.home-assistant.io too. The integration is broken as of now.

petrmac avatar Nov 17 '22 20:11 petrmac