home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.72k stars 29.98k forks source link

New Aladdin Connect integration requires OAuth credentials, no documentation for retrieval #120024

Closed missedtheapex closed 3 months ago

missedtheapex commented 3 months ago

The problem

When trying to add the new Aladdin Connect integration, I am presented with the dialog screenshot below. However, the documentation linked doesn't give any info for retrieving the OAuth credentials, and the Aladdin Connect iOS app doesn't have any obvious way of finding them. From my user POV, there's no way to get this integration running. And the documentation on the HA website has not been updated to reflect the release of the new Integration.

aladdin

I used the old (v5) integration without issue, deleted it from HA when it stopped working due to the API changes, and am now trying to add the new one (v6) back. I notice that in config_flow.py, there is code for "reauth" and "create oauth entry", but don't understand Python enough to know if that is intended to be asking me for my login credentials to retrieve the OAuth credentials. If that is the intended behavior of the config flow, then in my instance there seems to be no attempt to do that. I'm ony prompted for a Client ID and Client Secret that I can't discover.

What version of Home Assistant Core has the issue?

core-2024.6.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Aladdin Connect

Link to integration documentation on our website

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

Diagnostics information

No logs available; cannot install integration to create logs.

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 3 months ago

Hey there @swcloudgenie, mind taking a look at this issue as it has been labeled with an integration (aladdin_connect) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `aladdin_connect` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign aladdin_connect` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


aladdin_connect documentation aladdin_connect source (message by IssueLinks)

swcloudgenie commented 3 months ago

Is this perhaps an older version of Home Assistant? The new version does not require OAuth credentials, it should take the user directly to the login page.

swcloudgenie commented 3 months ago

I have tested this locally from the dev branch, and I am not asked for OAuth credentials. These credentials are stored in the cloud. Is it possible this integration was not able to connect to the HA cloud, and this was a fallback?

Either way, we cannot release these OAuth credentials, they must come from the HA cloud.

missedtheapex commented 3 months ago

Does that mean this integration is only available with the paid HA Cloud? That's not clear from the documentation...mainly because there is no updated documentation.

Will there not be an option for a manual workaround, as is the case with many other integrations? Seems that being able to use the phone app or a website to get API credentials for my account would allow the integration to work as-is. That's a common method for many other services.

swcloudgenie commented 3 months ago

Does that mean this integration is only available with the paid HA Cloud? That's not clear from the documentation...mainly because there is no updated documentation.

Will there not be an option for a manual workaround, as is the case with many other integrations? Seems that being able to use the phone app or a website to get API credentials for my account would allow the integration to work as-is. That's a common method for many other services.

No, this is available without the paid account. I have tested this myself without the paid account, and I am directed to the login page without any request for OAuth credentials. Are there any error/warning logs from the integration before you reach this screen? I am not familiar with the inner workings of the auth flow, but I am wondering if this is a fallback mechanism.

joostlek commented 3 months ago

@swcloudgenie you implemented a oauth flow, that means users have to fill in aouth client id and secret. They are stored in https://my.home-assistant.io/redirect/application_credentials/

missedtheapex commented 3 months ago

Are there any error/warning logs from the integration before you reach this screen?

None at all. That dialog is the only thing that appears after clicking "Add Integration" and selecting AC. Nothing shows up in the log, either from the AC integration or from HA in general.

Sounds like @joostlek knows something, which might be helpful because we've exceeded my non-dev understanding of how to implement these things.

joostlek commented 3 months ago

I only know code wise, i dont have any device myself

swcloudgenie commented 3 months ago

@swcloudgenie you implemented a oauth flow, that means users have to fill in aouth client id and secret. They are stored in https://my.home-assistant.io/redirect/application_credentials/

The OAuth credentials are stored on Home Assistant side. We cannot release these credentials to end users. I have tested this on my own installation without the credentials and it works okay.

joostlek commented 3 months ago

Did you see anything in the application credentials page on your instance?

swcloudgenie commented 3 months ago

Did you see anything in the application credentials page on your instance?

I was never taken to the application credentials page from the screenshot above. As soon as I initiate the setup, I am taken directly to the AladdinConnect login page.

joostlek commented 3 months ago

I sent a link which takes you there

missedtheapex commented 3 months ago

Did you see anything in the application credentials page on your instance?

Me? No. I only have one entry in my Application Credentials, and it's for another integration. Nothing for Aladdin.

And I can't see why there would be, since at no point did HA or the Aladdin integration ask me for my Genie account info. Maybe it would have if I still had things saved from the old integration? But I wiped that out months ago.

So unlike @swcloudgenie, I'm not being taken to a login page and I'm not sure why. Can confirm this is true whether I use my laptop browser or the HA iOS app to try an add the integration.

swcloudgenie commented 3 months ago
image image

This is what happens when I add it on my end. As soon as I click on Aladdin Connect, I am taken to the external login screen

joostlek commented 3 months ago

@swcloudgenie, please click the link I sent and go to the application credentials screen on your instance

swcloudgenie commented 3 months ago

@joostlek here is that screen on my instance:

image
missedtheapex commented 3 months ago

Update:

I spooled up a start-from-scratch Home Assistant install on a fresh VM. I used a Docker image since that's what my main installation is, too. When I loaded that HA instance, adding the Aladdin Connect integration pops up a login window in my browser to get my username/password. In short, that works as expected.

But my active installation still doesn't cooperate. I changed my Docker image tag from "stable" to "dev" to get as updated an image as possible. Even then, it doesn't create the same login screen, it just has the HA dialog for OAuth credentials.

My HA install is years old and could be carrying any number of legacy configuration "nuances" that might interfere. Maybe the biggest difference between this and my test container is that my real HA instance sits behind a reverse proxy (nginx) and has a let's encrypt certificate for a custom domain. But there could be a hundred other things...and unfortunately nothing shows up in the logs to help.

So it appears to be a "me" problem, but it might be something that affects a whole class of users in specific circumstances.

missedtheapex commented 3 months ago

Final Update:

I figured out that I did not have the Cloud enabled in my ancient configuration.yaml. After adding the cloud: line and restarting HA, I was able to get the Aladdin Connect login screen and added the integration successfully.

Hopefully if anyone else has a similar problem, they'll find this and save themselves some time.

Sorry for the confusion! I guess I need to take some quality time and rebuild my HA instance one of these days...it's held together with duct tape and bubble gum at this point.

joostlek commented 3 months ago

sorry @swcloudgenie you were right, we did get them from the cloud.

What this means is that you need to have either default_config: or cloud: in your configuration.yaml to be able to login

mkmer commented 3 months ago

I was seeing this same situation in the beta test. Default was enabled in the standard, and sometimes it went to the creds, sometimes it went to the oauth web site. There may be something more than the configuration causing the dialog to appear, but I couldn't get it to repeat for debug. Maybe a race in the async stuff?