jwillemsen / daikin_onecta

Home Assistant Integration for devices supported by the Daikin Onecta App
https://github.com/jwillemsen/daikin_onecta
GNU General Public License v3.0
251 stars 9 forks source link

[Issue]: It is impossible to authenticate; the app sends the wrong redirect URL V 4.1.6 #221

Closed senzatempo closed 2 months ago

senzatempo commented 3 months ago

I can't authenticate. I followed all the steps, but when I launch the integration for the first authentication, I receive an error from the Daikin page. Reading the query string of the error page, it seems that HA is sending the wrong redirect URL: 'my.home-assistant.io', instead of the URL of my instance, which is correctly configured and accessible from the outside

https://id.daikin.eu/cdc/onecta/oidc/registration-login.html?error=true&mode=error&clientID=*****************************&message=The%2Bredirect%2BURI%2Bin%2Bthe%2Brequest%3A%2Bhttps%3A%2F%2Fmy.home-assistant.io%2Fredirect%2Foauth%2Bdid%2Bnot%2Bmatch%2Ba%2Bregistered%2Bredirect%2BURI.&code=invalid_request&skipConsent=false

jwillemsen commented 3 months ago

You should make sure that the redirect_uri you configure at the Daikin portal is the exact one as your HA instance uses. Always first try the default as mentioned in the readme, when that doesn't work you can try another redirect_uri, but you must use the same URL as your HA instance uses at the Daikin portal

jwillemsen commented 3 months ago

It is currently not yet possible to retrieve the redirect_uri your HA instance will send, created https://github.com/home-assistant/core/issues/117169 for that

jwillemsen commented 3 months ago

Did the default work?

rudybroersma commented 3 months ago

This issue got to me as well. I replaced the default my.home-assistant.io to my actual domain (which I now understand is false). However, when clicking on ' Add' the integration no longer asks for my client ID and client secret while those details have changed because I removed and recreated the App in the Daikin portal.

Any way to purge those saved credentials?

jwillemsen commented 3 months ago

See readme under reinstall

rudybroersma commented 3 months ago

Thanks, that was quick! Worked. To further comment on this issue: @senzatempo you need to use https://my.home-assistant.io/redirect/oauth as URL. Do not replace is with your own installation.

videobuff commented 3 months ago

I now get stuck with the following:

DAIKIN ONECTA already_in_progress

I can only close it but it comes up every time.

jwillemsen commented 3 months ago

Try to restart HA

videobuff commented 3 months ago

I have restarted HA but the same problem persisted. So I restored HA from three days ago and Daikin Onecta is working. I then updated it to 4.1.9. and it is still working. However, i got a mail from Daikin that i still have an old API set of keys. I went to their site and created a new set. My question is now: how to replace the old api set of keys with the new one. ? The last time i deleted the three AC units and then when i created them again the problem started. So what is the correct procedure.

videobuff commented 3 months ago

In addition i see this "error" in the url from Daikin when intried yesterday to register. I have blurred my ID but that is not the latest ID for the new API. https://id.daikin.eu/cdc/onecta/oidc/registration-login.html?error=true&mode=error&clientID=XXXXXXXXXXXXXXXXXXX&message=The%2Bclient%2Bwas%2Bnot%2Bfound.&code=unauthorized_client&skipConsent=false

Update 23-06-24 So i located the application credentials from HA and there is the old Daikin Onecta credtial. I added the new one, but it refuses to delete the old obe. I stopped the Onecta integration and still not possible to delete.

Scherm­afbeelding 2024-06-22 om 00 30 00
jwillemsen commented 3 months ago

You must first remove the daikin onecta integration in HA, remove the credentials, and add it again in HA

jwillemsen commented 3 months ago

No need to do anything in the daikin onecta app, only in HA and the daikin developer portal

videobuff commented 3 months ago

Thank you. Succeeded.

jwillemsen commented 3 months ago

Any update @senzatempo ?

senzatempo commented 2 months ago

Sorry for the delayed response, I had misunderstood the instructions and when creating the app on the Daikin dev portal, I was using the URI of my instance. Now it works, it wasn't a bug, just my misunderstanding. Thank you for your work on the integration.