ReneNulschDE / mbapi2020

Custom Component to integrate MercedesME devices into Home-Assistant
Other
142 stars 27 forks source link

Failing to Authenticate on 2024.3 #212

Closed 74Rog closed 1 month ago

74Rog commented 4 months ago

The problem

My HA installation was failing to update to 2024.3 so I've redeployed from scratch and then restored from backup and then waas able to upgrade to 2024.3. I get a message that I need to reauthenticate MercedesMe 2020, I get the email with the code and enter it but it fails to authenticate with the following error in the HA logs.

This error originated from a custom integration.

Logger: custom_components.mbapi2020 Source: custom_components/mbapi2020/init.py:63 integration: MercedesME 2020 (documentation, issues) First occurred: 22:36:27 (2 occurrences) Last logged: 22:37:21

Authentication failed. Please reauthenticate.

What version of MBAPI2020 do use?

v0.12.0

What was the last working version of MBAPI2020?

v0.11.1

What type of installation are you running?

Home Assistant OS

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

ReneNulschDE commented 4 months ago

Please enable the debug log, run the process again and share the log

tbkon3 commented 4 months ago

same for me: the error is: [%key:common::config_flow::abort::reauth_successful%]

tbkon3 commented 4 months ago

Fixed: Deleted the old "Hub", reboot and reconfigured, all ok!!!

ReneNulschDE commented 4 months ago

same for me: the error is: [%key:common::config_flow::abort::reauth_successful%]

Do you still have the logs? This is a standard HA key and this one is used everywhere... What is youre HA version?

74Rog commented 4 months ago

I've deleted and reinstalled now and it is fine. It did start to get a bit weird as I had multiple reconfigure buttons in Devices and Services but all good now.

churchofnoise commented 3 months ago

Seems to be occurring here too since the last update (2024.3.3?)

ReneNulschDE commented 3 months ago

Thanks, This is not related to 2024.3.3.

Workaround currently: Delete integration in HA (not in HACS) and re-add integration after a restart.

janwilms commented 3 months ago

This is the error I got now

This error originated from a custom integration.

Logger: custom_components.mbapi2020.oauth Source: custom_components/mbapi2020/oauth.py:312 integration: MercedesME 2020 (documentation, issues) First occurred: 08:48:43 (3 occurrences) Last logged: 08:52:47

Error requesting: https://id.mercedes-benz.com/as/token.oauth2 - 0 - {"error_description":"unknown, invalid, or expired refresh token","error":"invalid_grant"}

ReneNulschDE commented 3 months ago

In what context did you got this error? HA-Upgrade / Restore?

Marijncouckuyt commented 3 months ago

I ran into the same problem after upgrading to 24.3.3. It fails to reauth after removing the integration and reinstalling it. Gives 'unknown error'

EDIT: retried few hours later and now works fine

j9brown commented 3 months ago

Hmm, I understand why the auth tokens expire and may need to be refreshed after an update, but why does authentication still not work after the reconfigure task completes successfully?

j9brown commented 3 months ago

Still unable to re-authenticate in v0.13.

ReneNulschDE commented 3 months ago

I have made one change in v0.14-beta1 and try to read from the HA config store first instead of using the file cache... But still testing it on my instances.

j9brown commented 2 months ago

I noticed this in the beta release notes. Not sure whether it is relevant but it sounds superficially related: https://developers.home-assistant.io/blog/2024/04/25/always-reload-after-successful-reauth-flow/

ReneNulschDE commented 2 months ago

Sounds related but we want the reload after the auth issue. I changed the flow a little bit in the latest beta of the component. Now I try to load the tokens from the cache instead of the file system.

DirkV71 commented 1 month ago

Problem to create new hub.

German Customer with *.com Email-Adress. Only can create a Hub for North America. But there it can´t find my car via VIN.

The log file throw this error:

Error requesting: https://bff.emea-prod.mobilesdk.mercedes-benz.com/v1/login - 0

Regards, Dirk

Rainman67 commented 1 month ago

I have a german *.de E-Mail-Adress and exactly the same problem. Maybe the authentication-server of Mercedes is temporarily down?

Regards, Michael

DirkV71 commented 1 month ago

Yes, thats a option. I downgrade the integration to Version 0.12 and the problem was still there. I will try it tomorow again...

Andreasroessler248 commented 1 month ago

Hi Dirk some issue here started today in the morning. Seems to be a general issue.

ReneNulschDE commented 1 month ago

see here #231

DirkV71 commented 1 month ago

Hi, check the bug fix manually. Works fine for me again!

image

ReneNulschDE commented 1 month ago

Will close this one. The first issue was a HA-core bug.