audiconnect / audi_connect_ha

Adds an audi connect integration to home assistant
MIT License
237 stars 97 forks source link

Refresh token failed: `access_token` #456

Closed mm98 closed 3 months ago

mm98 commented 3 months ago

Describe the bug I've started seeing lots of Refresh token failed: access_token errors in the logs. The integration is working, so this is actually just reporting the error from the logs (if that helps in any way to fix it).

I remove the integration and add it again. Same errors in logs.

This error originated from a custom integration.

Logger: custom_components.audiconnect.audi_services
Source: custom_components/audiconnect/audi_services.py:899
integration: Audi Connect (documentation, issues)
First occurred: July 28, 2024 at 08:08:37 (89 occurrences)
Last logged: 06:08:38

Refresh token failed: 'access_token'

To Reproduce None

Expected behavior Error shouldn't be there? 😀

Screenshots None

Logfile home-assistant_audiconnect_2024-07-29T04-18-06.902Z.log

Your Vehicle Details Model: A5 Sportback advanced 40 TFSI S tronic Year: 2021 Type (Gas/Hybrid/Electric): Gas Region (EU/US/CA/CN): EU

mm98 commented 3 months ago

I've just updated to v1.10.1 and the error is gone. I'll keep this issue open for a few days to validate that it was fixed by something else or not (coming back).

coreywillwhat commented 3 months ago

The brief outage over the weekend from Audi servers may have caused security tokens to need to be renewed. A reboot/relogin to Audi servers likely would have fixed it. I agree, keep it open and let us know if it returns in a few days at all.

mm98 commented 3 months ago

A reboot/relogin to Audi servers likely would have fixed it.

That was my guess as well and the reason for the reinstall. Didn't solve or fix the auth problem though.

A thought if a refresh_token is invalid or expired, shouldn't this automatically force a reauth which returns a new refresh token?

coreywillwhat commented 3 months ago

I would think so, but I'm just diving into the API side of things and trying to review.

I was looking at the network requests from the myAudi app during the outage and it seems the reason for the outage might have been updating things on the backend again, this time also involving authorization and security.

I had fixed a lot of the services before the outage, but unfortunately after the changes, it seems things are not working again. Will need to keep working on it when I have time.

mm98 commented 3 months ago

The error has not returned. I'll close this.