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

Husqvarna Automower setup fails, after deletion of integration, and change of application secret #119643

Closed OhmegaStar closed 3 months ago

OhmegaStar commented 3 months ago

The problem

Had the old custom HACS Husqvarna Automower integration setup. Added the new core integration, in between the two actions i changed my secret at the Husqvarna Developer account. Now the integration setup skips the request for client id and secret, and goes direct to the husqvarna portal to link accounts. this fails; image

in the logs i see

2024-06-13 22:45:13.919 ERROR (MainThread) [homeassistant.helpers.config_entry_oauth2_flow] Token request for husqvarna_automower_REDACTED failed (invalid_client): Client or client secret is invalid 2024-06-13 22:45:13.919 ERROR (MainThread) [homeassistant.helpers.config_entry_oauth2_flow] Error resolving OAuth token: 400, message='Bad Request', url=URL('https://api.authentication.husqvarnagroup.dev/v1/oauth2/token')

I'm unable to configure the integration as the automatic setup never completes.

Please advice

What version of Home Assistant Core has the issue?

core-2024.6.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Husqvarna Automower

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

`2024-06-13 22:45:13.919 ERROR (MainThread) [homeassistant.helpers.config_entry_oauth2_flow] Token request for husqvarna_automower_REDACTED failed (invalid_client): Client or client secret is invalid
2024-06-13 22:45:13.919 ERROR (MainThread) [homeassistant.helpers.config_entry_oauth2_flow] Error resolving OAuth token: 400, message='Bad Request', url=URL('https://api.authentication.husqvarnagroup.dev/v1/oauth2/token')
`

Additional information

Seems to be caused by adding new integration / removing hacs integration, and changing husqvarna secret in some combination

home-assistant[bot] commented 3 months ago

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

Code owner commands Code owners of `husqvarna_automower` 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 husqvarna_automower` 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)


husqvarna_automower documentation husqvarna_automower source (message by IssueLinks)

Thomas55555 commented 3 months ago

Please delete any wrong secrets here: https://www.home-assistant.io/integrations/application_credentials/

OhmegaStar commented 3 months ago

Thanks Thomas, Just found the closed bug with the same suggestion, now it works. May I suggest you may add a handler in this case (credentials exist, but oauth fails on setup), as the fact that the credentials exist is not clear. Thanks for the quick answer!