raman325 / ha-zoom-automation

Custom Home Assistant component for Zoom. Tracks when you are connected to a Zoom call by default but may allow you to track more.
MIT License
60 stars 15 forks source link

Home Assistant Cloud URL used as Redirect URL for OAuth instead of user's configured external URL #56

Open ScottG489 opened 2 years ago

ScottG489 commented 2 years ago

Version of the custom_component

v0.8.3

Configuration

Failure occurs during UI Integration Configuration

Describe the bug

The integration seems to use my Home Assistant Cloud URL (via a Nabu Casa subscription) instead of the external URL that I have configured in Configuration > Settings > General (/config/core). When I am redirected I get sent to a page with this error:

{"status":false,"errorCode":4700,"errorMessage":"Invalid redirect: https://<unique id>.ui.nabu.casa/auth/external/callback","result":null}

I was able to fix this by manually changing the redirect URL parameter in the URL, but I think the external URL that the user specifies in their configuration is what this integration should be using. The installation documentation even specifies that you should use the

...URL you configured inside of Home Assistant as the external URL...

I assume this could also be worked around by specifying the HA Cloud URL for the Redirect URL for OAuth while going through the installation steps.

Debug log

No relevant logs occur

ScottG489 commented 2 years ago

I needed to get verification by my company to get the app approved. After approving it, it turns out that my fix doesn't actually work and I get an error. I think it may be similar to the issue mentioned in #18.

The other workaround I mentioned of adding my HA Cloud URL did seem to work. However, the root cause of this problem still needs to be resolved.

raman325 commented 2 years ago

that seems like an upstream bug, the cloud URL should be able to get back to your instance and everything should work. Is there a reason why you think or know that the Nabu Casa URL above should not work?

ScottG489 commented 2 years ago

I think the problem was that the docs say to specify the external URL the user has configured for HA. However, the integration ends up using the Nabu Casa URL which is different. So I feel like the docs should be updated to mention this. What do you think?

I actually also think that the user's specified external URL should be preferred over the Nabu Casa URL. Are you saying this is an upstream bug because HA is giving you the wrong URL to use as the external URL? Because to clarify, that URL does work fine.

I already set up external access to my HA instance before I signed up for Nabu Casa cloud and just generally use my own URL and don't use the Nabu Casa one at all. I just signed up for Nabu Casa cloud to support them.