ReneNulschDE / mbapi2020

Custom Component to integrate MercedesME devices into Home-Assistant

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failing to Authenticate on 2024.3

74Rog opened this issue · comments

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

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

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

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

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?

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.

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

Thanks, This is not related to 2024.3.3.

  • The multiple button problem is on my list.
  • Reauth-Problem: I assume that this happens after an upgrade of HA in an HAOS environment. Whenever the backup is not created near time (<10min) before the upgrade than there is a high risk that invalid keys are stored in the backup. (Reason: the auth and reauth keys are vaild for 120min only and are renewed every 110min)

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

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"}

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

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

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?

Still unable to re-authenticate in v0.13.

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.

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/

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.

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

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

Regards, Michael

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

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

see here #231

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

image

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