astrandb / miele

A modern integration for Miele devices in Home Assistant
MIT License
193 stars 29 forks source link

Cannot start the integration #440

Closed jkremlacek closed 7 months ago

jkremlacek commented 7 months ago

The problem

Hi all,

I followed the instructions, managed to get OAuth credentials, put them into the integration, log into Miele, but on the redirect back to HASS the I will get simple dialog:

OAuth authorization error while obtaining access token.

Version of miele integration having the issue?

v2024.1.0

Version of Home Assistant Core having the issue?

2024.2.3

Anything in the logs that might be useful for us?

No response

Additional information

No response

jkremlacek commented 7 months ago

Found out the issue.

In .storage/application_credentials is the OAuth client id and client secret. Copying them directly from the webpage of Miele also copied tab and space characters \t which are invisible in the inputs of Home Assistant, however they mess up the login.

(in Home Assistant supervised the full path is /usr/share/hassio/homeassistant/.storage/application_credentials

So the fix was to edit the file with nano, removing the extra characters from secret and restarting Home Assistant.

Maybe it would be worth to enhance the error dialog with the information, that most likely the provided credentials are wrong and some hint where to check / fix them :)

astrandb commented 7 months ago

This problem is not specific to this integration. The whole OAuth2 setup is done within Home Assiatnt core and I don't think we should try to replicate it to "just" to minimize user errors. However, you are not the first guy to see this problem. I suggest that you rise an issue in HA core repository and suggest that they strip client_id and client_secret from leading and trailing whitespace before continuing the config flow. BTW you can delete app credentials and start over by selecting the overflow menu (three dots) in Settings->Devices and services.