Closed Personear closed 2 years ago
What version are you using?
v1.2.2
odd. Could we get more logs, in particular looking to see if the token is getting refreshed by the system. It should see what time it expires and renew it before using it.
Does this happen each time or does it only happen when you log into the Hyundai app? I think the Kia USA API expires all tokens whenever the app is used. If that is the case we can do something to handle this better.
Here's some more logs. I redacted some personal info (email, access tokens, refresh tokens). It does indeed show when the token should expire and does refresh the token if needed. Maybe the token can be expired if too many requests are used at once? It does not happen if I log in to the Hyundai app. I can't actually seem to replicate it now.
I'm running v1.2.3 now.
2021-12-12 22:30:38 DEBUG (MainThread) [custom_components.kia_uvo.Vehicle] kia_uvo - Received token into Vehicle Object {'valid_until': '2021-12-12 11:45:42.333384', 'access_token': 'REDACTED', 'refresh_token': 'REDACTED', 'device_id': None, 'vehicle_name': '2021 ELANTRA', 'vehicle_id': 'REDACTED', 'vehicle_regid': 'REDACTED', 'vehicle_model': 'ELANTRA', 'vehicle_registration_date': '20210211', 'stamp': 'NoStamp'}
2021-12-12 22:30:38 DEBUG (MainThread) [custom_components.kia_uvo.Vehicle] kia_uvo - Refresh token started 2021-12-12 11:45:42.333384 2021-12-12 22:30:38.380702 True
2021-12-12 22:30:38 DEBUG (MainThread) [custom_components.kia_uvo.Vehicle] kia_uvo - Refresh token expired
2021-12-12 22:30:40 DEBUG (SyncWorker_5) [custom_components.kia_uvo.HyundaiBlueLinkAPIUSA] kia_uvo - Sign In Response {"access_token":"REDACTED","refresh_token":"REDACTED","expires_in":"1799","username":"REDACTED"}
2021-12-12 22:30:40 DEBUG (SyncWorker_5) [custom_components.kia_uvo.HyundaiBlueLinkAPIUSA] kia_uvo - Access Token Value REDACTED
2021-12-12 22:30:40 DEBUG (SyncWorker_5) [custom_components.kia_uvo.HyundaiBlueLinkAPIUSA] kia_uvo - Refresh Token Value REDACTED
If this has not happened again maybe we close this?
Sure. I'll close it.
Description: When the BlueLink token expires, the below error occurs. To fix, I have to reload the integration. It looks like the code doesn't expect an expired token.
Reproduce: Not sure how to expire a token. Maybe it's based on time or over utilizing the quota? Once a token is expired, request an update from cache (not forced) and you'll get the below error.
Region and Brand: USA - Hyundai Elantra 2021 SEL