GithubHelp home page GithubHelp logo

Comments (22)

ReneNulschDE avatar ReneNulschDE commented on July 20, 2024 1

Thanks - let me try to find out why HA does not store the new token. We see in your log that after 3ms the reload starts, I assume that the token is not saved.

@dersch81 : Can you try the same?

from mbapi2020.

dersch81 avatar dersch81 commented on July 20, 2024 1

Thanks - let me try to find out why HA does not store the new token. We see in your log that after 3ms the reload starts, I assume that the token is not saved.

@dersch81 : Can you try the same?

Yes, that fixed it! Many thanks! I did never notice that option but now i will never forget :)

from mbapi2020.

ReneNulschDE avatar ReneNulschDE commented on July 20, 2024

Hi,

thanks. The Key-error is fixed in the latest beta.

The root cause is still unknown. I had this once this week and currently try to find out the root cause. In case you want help, please set the log level for the component to debug and share the log via email [email protected] after it happens again.

from mbapi2020.

kneip68 avatar kneip68 commented on July 20, 2024

Just had the reauthentification issue after installing latest stable, then installed latest beta. Now works again.

Unfortunatly Debug log downloaded does not contain the error messages before restart, but at least I can confirm beta is working for me.

Thx for all your work.

KR

Kneip

from mbapi2020.

fvbrandt avatar fvbrandt commented on July 20, 2024

I had the same KeyError: 'entry_id' and thus upgraded to v0.11.2-beta.1 but now I have a different problem:
I still get Authentication failed. Please reauthenticate. but it is persistent now (i.e. the error appears each time after I re-authenticate) and the exception is this:

 ERROR (MainThread) [custom_components.mbapi2020.oauth] Error requesting: https://id.mercedes-benz.com/as/token.oauth2
 - 0 - {"error_description":"unknown, invalid, or expired refresh token","error":"invalid_grant"}

Is this a wholly separate issue? Any ideas how to fix it?

from mbapi2020.

dersch81 avatar dersch81 commented on July 20, 2024

I had the same KeyError: 'entry_id' and thus upgraded to v0.11.2-beta.1 but now I have a different problem: I still get Authentication failed. Please reauthenticate. but it is persistent now (i.e. the error appears each time after I re-authenticate) and the exception is this:

 ERROR (MainThread) [custom_components.mbapi2020.oauth] Error requesting: https://id.mercedes-benz.com/as/token.oauth2
 - 0 - {"error_description":"unknown, invalid, or expired refresh token","error":"invalid_grant"}

Is this a wholly separate issue? Any ideas how to fix it?

Same here. I can't reauthenticate now anymore with the same error. I also reinstalled the last stable but same issue.

from mbapi2020.

ReneNulschDE avatar ReneNulschDE commented on July 20, 2024

I have published a new beta version v0.11.2-beta2

This adds some special handling to hopefully address the issue.

from mbapi2020.

dersch81 avatar dersch81 commented on July 20, 2024

I have published a new beta version v0.11.2-beta2

This adds some special handling to hopefully address the issue.

Unfortunatley not.

2024-03-04 13:26:03.728 DEBUG (MainThread) [custom_components.mbapi2020] Start async_setup_entry.
2024-03-04 13:26:03.728 DEBUG (MainThread) [custom_components.mbapi2020.client] WSL not detected - running in rlock mode
2024-03-04 13:26:03.728 DEBUG (MainThread) [custom_components.mbapi2020.oauth] Start async_get_cached_token()
2024-03-04 13:26:03.729 DEBUG (MainThread) [custom_components.mbapi2020.oauth] custom_components.mbapi2020.oauth token expired -> start refresh
2024-03-04 13:26:03.729 INFO (MainThread) [custom_components.mbapi2020.oauth] Start async_refresh_access_token() with refresh_token
2024-03-04 13:26:03.729 INFO (MainThread) [custom_components.mbapi2020.oauth] Auth token refresh preflight request 1
2024-03-04 13:26:03.731 DEBUG (MainThread) [custom_components.mbapi2020] Can not connect to MB OAuth API https://id.mercedes-benz.com. Will try again.

from mbapi2020.

ReneNulschDE avatar ReneNulschDE commented on July 20, 2024

Sorry, my mistake - the dev proxy was still active. I have published a new beta release v0.11.2-beta.3

from mbapi2020.

dersch81 avatar dersch81 commented on July 20, 2024

image

image

Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.mbapi2020.oauth
Source: custom_components/mbapi2020/oauth.py:317
Integration: MercedesME 2020 (documentation, issues)
First occurred: 14:15:47 (2 occurrences)
Last logged: 14:19:57

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

When i then try again, i don't receive a new PIN anymore via mail and the integration will not stop to ask for a PIN which i never receive.

from mbapi2020.

ReneNulschDE avatar ReneNulschDE commented on July 20, 2024

Are you sure that you installed the latest beta version 0.11.2-beta.3? Please enable the debug log and restart HA. Then try again to request a pin.

from mbapi2020.

dersch81 avatar dersch81 commented on July 20, 2024

Yes

image

from mbapi2020.

ReneNulschDE avatar ReneNulschDE commented on July 20, 2024

Could you open a new issue and share the debug log, system information, please - we have to analyze why you don't get a pin.

from mbapi2020.

dersch81 avatar dersch81 commented on July 20, 2024

Sure i can do, but i don't think it has anything to do with the mail itself. Still getting this:

2024-03-04 15:48:58.577 DEBUG (MainThread) [custom_components.mbapi2020] Start async_setup_entry.
2024-03-04 15:48:58.577 DEBUG (MainThread) [custom_components.mbapi2020.client] WSL not detected - running in rlock mode
2024-03-04 15:48:58.577 DEBUG (MainThread) [custom_components.mbapi2020.oauth] Start async_get_cached_token()
2024-03-04 15:48:58.578 DEBUG (MainThread) [custom_components.mbapi2020.oauth] custom_components.mbapi2020.oauth token expired -> start refresh
2024-03-04 15:48:58.578 INFO (MainThread) [custom_components.mbapi2020.oauth] Start async_refresh_access_token() with refresh_token
2024-03-04 15:48:58.578 INFO (MainThread) [custom_components.mbapi2020.oauth] Auth token refresh preflight request 1

from mbapi2020.

ReneNulschDE avatar ReneNulschDE commented on July 20, 2024

Did you rerun the reauth procedure? What is the log entry after preflight?

from mbapi2020.

dersch81 avatar dersch81 commented on July 20, 2024

Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.mbapi2020.oauth
Source: custom_components/mbapi2020/oauth.py:317
Integration: MercedesME 2020 (documentation, issues)
First occurred: 15:49:07 (2 occurrences)
Last logged: 16:24:10

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

from mbapi2020.

ReneNulschDE avatar ReneNulschDE commented on July 20, 2024

Could please try to be a little bit more descriptive otherwise I cant help you? This error message is not an reauth-error. If you don't want to do this, then you can only delete the integration from the HA integration page and re-add it to get a clean state.

from mbapi2020.

dersch81 avatar dersch81 commented on July 20, 2024

But this was the answer of your request. I don't had any other error in the log right after the preflight.

Also i think there is no other request for a new PIN if no Pin or a wrong or a expired pin has been entered. This need to be handled by the integration i guess. But in my case without a PIN or an expired there is no way to request a new one.

from mbapi2020.

fvbrandt avatar fvbrandt commented on July 20, 2024

Thank you @ReneNulschDE for taking the time to help us. I'll try to add what I can.

  • I have a docker installation, HA v2024.2.5
  • I also have beta3 of the integration installed now
  • Since the initial KeyError above I always have a notification that the MB integration needs to be reconfigured. When I click reconfigure, I am prompted to authenticate again. So I enter my login and PIN:
    image
  • Then I get this success message:
    image
  • But once I close that popup, I still have the reconfigure prompt and this view:
    image
  • The whole debug log through the full re-authentication process is this:
2024-03-04 18:43:33.047 INFO (MainThread) [custom_components.mbapi2020.oauth] Start request PIN <[email protected]>
2024-03-04 18:43:33.047 INFO (MainThread) [custom_components.mbapi2020.oauth] PIN preflight request 1
2024-03-04 18:43:33.252 INFO (MainThread) [custom_components.mbapi2020.oauth] PIN request
2024-03-04 18:43:41.449 DEBUG (MainThread) [custom_components.mbapi2020] Token received
2024-03-04 18:43:41.452 DEBUG (MainThread) [custom_components.mbapi2020] Start async_setup_entry.
2024-03-04 18:43:41.453 DEBUG (MainThread) [custom_components.mbapi2020.client] WSL not detected - running in rlock mode
2024-03-04 18:43:41.453 DEBUG (MainThread) [custom_components.mbapi2020.oauth] Start async_get_cached_token()
2024-03-04 18:43:41.455 DEBUG (MainThread) [custom_components.mbapi2020.oauth] custom_components.mbapi2020.oauth token expired -> start refresh
2024-03-04 18:43:41.456 INFO (MainThread) [custom_components.mbapi2020.oauth] Start async_refresh_access_token() with refresh_token
2024-03-04 18:43:41.456 INFO (MainThread) [custom_components.mbapi2020.oauth] Auth token refresh preflight request 1
2024-03-04 18:43:41.721 ERROR (MainThread) [custom_components.mbapi2020.oauth] Error requesting: https://id.mercedes-benz.com/as/token.oauth2 - 0 - {"error_description":"unknown, invalid, or expired refresh token","error":"invalid_grant"}
2024-03-04 18:43:41.722 ERROR (MainThread) [custom_components.mbapi2020] Authentication failed. Please reauthenticate.

So far I am hesitant to just remove and install the integration again because I am worried that some entities might end up with different names or similar which would break my code. Let us know if you feel like you can't easily fix this, then I'll just take the bullet. ;)

from mbapi2020.

ReneNulschDE avatar ReneNulschDE commented on July 20, 2024

@fvbrandt : Thanks for the details. Do you have the option to click on the "configure" link on the integration page?

from mbapi2020.

fvbrandt avatar fvbrandt commented on July 20, 2024

@fvbrandt : Thanks for the details. Do you have the option to click on the "configure" link on the integration page?

💯 That was the right hint! Under the three-dot-menu there was the "configure" option and there I only chose "Delete authentication token file now. require a restart of Home Assistant after save." and pressed submit. Then restart and one final re-authentication and this time it worked. So I guess it was a missing cache invalidation in some place?

from mbapi2020.

Jealy91 avatar Jealy91 commented on July 20, 2024

Beta version & re-auth sorted this for me. Thanks as always @ReneNulschDE!

from mbapi2020.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.