evcc icon indicating copy to clipboard operation
evcc copied to clipboard

Oauth ticket is not used after refresh

Open MartijnvanGeffen13 opened this issue 1 year ago • 16 comments

Describe the bug

When a oauth token is expired and you use the GUI to refresh the token after validation the car get green icon for success validation but the new token does not seem to be used and a restart is needed.

In log files below token was renewed @12:01:30

After renew you see car is green , but errors keep popping up. Image

Image

Steps to reproduce

  1. Configure Oauth car connection for example Volvo
  2. Wait 7 days till expire
  3. Renew using the GUI
  4. after renew EVCC will throw errors token not valid, but car is green , if you restart everything is green . ...

Configuration details

both commands only output very high level whatis used 

scriptkiddie@evcc:~$ evcc config
[main  ] INFO 2025/10/13 12:22:51 using config file: /etc/evcc.yaml
[db    ] INFO 2025/10/13 12:22:51 using sqlite database: /home/scriptkiddie/.evcc/evcc.db
scriptkiddie@evcc:~$ evcc dump --cfg
[main  ] INFO 2025/10/13 12:23:00 using config file: /etc/evcc.yaml
[db    ] INFO 2025/10/13 12:23:00 using sqlite database: /home/scriptkiddie/.evcc/evcc.db
[alfen ] DEBUG 2025/10/13 12:23:00 detected 3p alfen
[circuit-main] DEBUG 2025/10/13 12:23:00 validation of max power disabled
[circuit-laadpaal] DEBUG 2025/10/13 12:23:00 validation of max power disabled
[lp-1  ] WARN 2025/10/13 12:23:00 poll mode '{connected 30m0s}' may deplete your battery or lead to API misuse. USE AT YOUR OWN RISK.
[lp-1  ] DEBUG 2025/10/13 12:23:01 charge total import: 5501.826kWh

Version: `0.209.1`

scriptkiddie@evcc:~$

Log details

[lp-1 ] DEBUG 2025/10/13 12:00:37 vehicle soc: 69%
[lp-1 ] ERROR 2025/10/13 12:00:37 vehicle soc limit: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token"
[lp-1 ] ERROR 2025/10/13 12:00:37 vehicle range: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token"
[lp-1 ] DEBUG 2025/10/13 12:00:37 pv charge current: 0A = 6A + -8.86A (2038W @ 1p)
[lp-1 ] DEBUG 2025/10/13 12:00:37 projected site power 2038W >= 1100W disable threshold
[lp-1 ] DEBUG 2025/10/13 12:00:37 pv disable in 3m15s
[lp-1 ] DEBUG 2025/10/13 12:00:37 pv disable timer remaining: 3m15s
[lp-1 ] DEBUG 2025/10/13 12:00:50 charge power: 1328W
[lp-1 ] DEBUG 2025/10/13 12:00:50 charge currents: [5.84 0 0]A
[lp-1 ] DEBUG 2025/10/13 12:00:51 charge voltages: [232 232 234]V
[lp-1 ] DEBUG 2025/10/13 12:00:51 detected active phases: 1p
[lp-1 ] DEBUG 2025/10/13 12:00:52 session energy: 0.917kWh
[lp-1 ] DEBUG 2025/10/13 12:00:52 charge total import: 5501.651kWh
[lp-1 ] DEBUG 2025/10/13 12:00:52 charger status: C
[lp-1 ] WARN 2025/10/13 12:00:52 vehicle soc: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token" (ignored by estimator)
[lp-1 ] DEBUG 2025/10/13 12:00:52 soc estimated: 69.45% (vehicle: 68.00%)
[lp-1 ] DEBUG 2025/10/13 12:00:52 vehicle soc: 69%
[lp-1 ] ERROR 2025/10/13 12:00:52 vehicle soc limit: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token"
[lp-1 ] ERROR 2025/10/13 12:00:52 vehicle range: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token"
[lp-1 ] DEBUG 2025/10/13 12:00:52 pv charge current: 0A = 6A + -8.97A (2064W @ 1p)
[lp-1 ] DEBUG 2025/10/13 12:00:52 projected site power 2064W >= 1100W disable threshold
[lp-1 ] DEBUG 2025/10/13 12:00:52 pv disable in 3m0s
[lp-1 ] DEBUG 2025/10/13 12:00:52 pv disable timer remaining: 3m0s
[lp-1 ] DEBUG 2025/10/13 12:01:05 charge power: 1328W
[lp-1 ] DEBUG 2025/10/13 12:01:06 charge currents: [5.84 0 0]A
[lp-1 ] DEBUG 2025/10/13 12:01:06 charge voltages: [232 232 234]V
[lp-1 ] DEBUG 2025/10/13 12:01:06 detected active phases: 1p
[lp-1 ] DEBUG 2025/10/13 12:01:07 session energy: 0.923kWh
[lp-1 ] DEBUG 2025/10/13 12:01:07 charge total import: 5501.657kWh
[lp-1 ] DEBUG 2025/10/13 12:01:07 charger status: C
[lp-1 ] WARN 2025/10/13 12:01:07 vehicle soc: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token" (ignored by estimator)
[lp-1 ] DEBUG 2025/10/13 12:01:07 soc estimated: 69.46% (vehicle: 68.00%)
[lp-1 ] DEBUG 2025/10/13 12:01:07 vehicle soc: 69%
[lp-1 ] ERROR 2025/10/13 12:01:07 vehicle soc limit: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token"
[lp-1 ] ERROR 2025/10/13 12:01:07 vehicle range: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token"
[lp-1 ] DEBUG 2025/10/13 12:01:08 pv charge current: 0.191A = 6A + -5.81A (1336W @ 1p)
[lp-1 ] DEBUG 2025/10/13 12:01:08 projected site power 1336W >= 1100W disable threshold
[lp-1 ] DEBUG 2025/10/13 12:01:08 pv disable in 2m44s
[lp-1 ] DEBUG 2025/10/13 12:01:08 pv disable timer remaining: 2m44s
[lp-1 ] DEBUG 2025/10/13 12:01:20 charge power: 1329W
[lp-1 ] DEBUG 2025/10/13 12:01:21 charge currents: [5.84 0 0]A
[lp-1 ] DEBUG 2025/10/13 12:01:22 charge voltages: [232 232 234]V
[lp-1 ] DEBUG 2025/10/13 12:01:22 detected active phases: 1p
[lp-1 ] DEBUG 2025/10/13 12:01:22 session energy: 0.928kWh
[lp-1 ] DEBUG 2025/10/13 12:01:22 charge total import: 5501.663kWh
[lp-1 ] DEBUG 2025/10/13 12:01:22 charger status: C
[lp-1 ] WARN 2025/10/13 12:01:22 vehicle soc: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token" (ignored by estimator)
[lp-1 ] DEBUG 2025/10/13 12:01:22 soc estimated: 69.47% (vehicle: 68.00%)
[lp-1 ] DEBUG 2025/10/13 12:01:22 vehicle soc: 69%
[lp-1 ] ERROR 2025/10/13 12:01:22 vehicle soc limit: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token"
[lp-1 ] ERROR 2025/10/13 12:01:22 vehicle range: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token"
[lp-1 ] DEBUG 2025/10/13 12:01:23 pv charge current: 0.0913A = 6A + -5.91A (1359W @ 1p)
[lp-1 ] DEBUG 2025/10/13 12:01:23 projected site power 1359W >= 1100W disable threshold
[lp-1 ] DEBUG 2025/10/13 12:01:23 pv disable in 2m29s
[lp-1 ] DEBUG 2025/10/13 12:01:23 pv disable timer remaining: 2m29s
[providerauth] DEBUG 2025/10/13 12:01:30 login request for: EX30 (44139d09)
[httpd ] ERROR 2025/10/13 12:01:30 http: superfluous response.WriteHeader call from github.com/gorilla/handlers.(*compressResponseWriter).WriteHeader (compress.go:26)
[lp-1 ] DEBUG 2025/10/13 12:01:35 charge power: 1330W
[lp-1 ] DEBUG 2025/10/13 12:01:36 charge currents: [5.84 0 0]A
[lp-1 ] DEBUG 2025/10/13 12:01:37 charge voltages: [232 232 234]V
[lp-1 ] DEBUG 2025/10/13 12:01:37 detected active phases: 1p
[lp-1 ] DEBUG 2025/10/13 12:01:37 session energy: 0.934kWh
[lp-1 ] DEBUG 2025/10/13 12:01:37 charge total import: 5501.668kWh
[lp-1 ] DEBUG 2025/10/13 12:01:37 charger status: C
[lp-1 ] WARN 2025/10/13 12:01:37 vehicle soc: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token" (ignored by estimator)
[lp-1 ] DEBUG 2025/10/13 12:01:37 soc estimated: 69.48% (vehicle: 68.00%)
[lp-1 ] DEBUG 2025/10/13 12:01:37 vehicle soc: 69%
[lp-1 ] ERROR 2025/10/13 12:01:37 vehicle soc limit: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token"
[lp-1 ] ERROR 2025/10/13 12:01:37 vehicle range: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token"
[lp-1 ] DEBUG 2025/10/13 12:01:38 pv charge current: 0A = 6A + -13.9A (3200W @ 1p)
[lp-1 ] DEBUG 2025/10/13 12:01:38 projected site power 3200W >= 1100W disable threshold
[lp-1 ] DEBUG 2025/10/13 12:01:38 pv disable in 2m14s
[lp-1 ] DEBUG 2025/10/13 12:01:38 pv disable timer remaining: 2m14s
[lp-1 ] DEBUG 2025/10/13 12:01:50 charge power: 1331W
[lp-1 ] DEBUG 2025/10/13 12:01:51 charge currents: [5.84 0 0]A
[lp-1 ] DEBUG 2025/10/13 12:01:51 charge voltages: [232 232 234]V
[lp-1 ] DEBUG 2025/10/13 12:01:51 detected active phases: 1p
[lp-1 ] DEBUG 2025/10/13 12:01:52 session energy: 0.939kWh
[lp-1 ] DEBUG 2025/10/13 12:01:52 charge total import: 5501.674kWh
[lp-1 ] DEBUG 2025/10/13 12:01:52 charger status: C
[lp-1 ] WARN 2025/10/13 12:01:52 vehicle soc: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token" (ignored by estimator)
[lp-1 ] DEBUG 2025/10/13 12:01:52 soc estimated: 69.49% (vehicle: 68.00%)
[lp-1 ] DEBUG 2025/10/13 12:01:52 vehicle soc: 69%
[lp-1 ] ERROR 2025/10/13 12:01:52 vehicle soc limit: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token"
[lp-1 ] ERROR 2025/10/13 12:01:52 vehicle range: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token"
[lp-1 ] DEBUG 2025/10/13 12:01:52 pv charge current: 0A = 6A + -14A (3213W @ 1p)
[lp-1 ] DEBUG 2025/10/13 12:01:52 projected site power 3213W >= 1100W disable threshold
[lp-1 ] DEBUG 2025/10/13 12:01:52 pv disable in 2m0s
[lp-1 ] DEBUG 2025/10/13 12:01:52 pv disable timer remaining: 2m0s
[lp-1 ] DEBUG 2025/10/13 12:02:05 charge power: 1329W
[lp-1 ] DEBUG 2025/10/13 12:02:06 charge currents: [5.84 0 0]A
[lp-1 ] DEBUG 2025/10/13 12:02:06 charge voltages: [232 233 234]V
[lp-1 ] DEBUG 2025/10/13 12:02:06 detected active phases: 1p
[lp-1 ] DEBUG 2025/10/13 12:02:06 session energy: 0.945kWh
[lp-1 ] DEBUG 2025/10/13 12:02:07 charge total import: 5501.679kWh
[lp-1 ] DEBUG 2025/10/13 12:02:07 charger status: C
[lp-1 ] WARN 2025/10/13 12:02:07 vehicle soc: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token" (ignored by estimator)
[lp-1 ] DEBUG 2025/10/13 12:02:07 soc estimated: 69.50% (vehicle: 68.00%)
[lp-1 ] DEBUG 2025/10/13 12:02:07 vehicle soc: 69%
[lp-1 ] ERROR 2025/10/13 12:02:07 vehicle soc limit: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token"
[lp-1 ] ERROR 2025/10/13 12:02:07 vehicle range: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token"
[lp-1 ] DEBUG 2025/10/13 12:02:07 pv charge current: 0A = 6A + -6.12A (1407W @ 1p)
[lp-1 ] DEBUG 2025/10/13 12:02:07 projected site power 1407W >= 1100W disable threshold
[lp-1 ] DEBUG 2025/10/13 12:02:07 pv disable in 1m45s
[lp-1 ] DEBUG 2025/10/13 12:02:07 pv disable timer remaining: 1m45s
[lp-1 ] DEBUG 2025/10/13 12:02:20 charge power: 1329W
[lp-1 ] DEBUG 2025/10/13 12:02:20 charge currents: [5.83 0 0]A
[lp-1 ] DEBUG 2025/10/13 12:02:21 charge voltages: [232 233 234]V
[lp-1 ] DEBUG 2025/10/13 12:02:21 detected active phases: 1p
[lp-1 ] DEBUG 2025/10/13 12:02:22 session energy: 0.951kWh
[lp-1 ] DEBUG 2025/10/13 12:02:22 charge total import: 5501.685kWh
[lp-1 ] DEBUG 2025/10/13 12:02:22 charger status: C
[lp-1 ] WARN 2025/10/13 12:02:22 vehicle soc: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token" (ignored by estimator)
[lp-1 ] DEBUG 2025/10/13 12:02:22 soc estimated: 69.51% (vehicle: 68.00%)
[lp-1 ] DEBUG 2025/10/13 12:02:22 vehicle soc: 70%
[lp-1 ] ERROR 2025/10/13 12:02:22 vehicle soc limit: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token"
[lp-1 ] ERROR 2025/10/13 12:02:22 vehicle range: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token"
[lp-1 ] DEBUG 2025/10/13 12:02:22 pv charge current: 0A = 6A + -6.27A (1442W @ 1p)
[lp-1 ] DEBUG 2025/10/13 12:02:22 projected site power 1442W >= 1100W disable threshold
[lp-1 ] DEBUG 2025/10/13 12:02:22 pv disable in 1m30s
[lp-1 ] DEBUG 2025/10/13 12:02:22 pv disable timer remaining: 1m30s
[lp-1 ] DEBUG 2025/10/13 12:02:35 charge power: 1327W
[lp-1 ] DEBUG 2025/10/13 12:02:36 charge currents: [5.83 0 0]A
[lp-1 ] DEBUG 2025/10/13 12:02:36 charge voltages: [232 233 234]V
[lp-1 ] DEBUG 2025/10/13 12:02:36 detected active phases: 1p
[lp-1 ] DEBUG 2025/10/13 12:02:36 session energy: 0.956kWh
[lp-1 ] DEBUG 2025/10/13 12:02:36 charge total import: 5501.690kWh
[lp-1 ] DEBUG 2025/10/13 12:02:36 charger status: C
[lp-1 ] WARN 2025/10/13 12:02:36 vehicle soc: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token" (ignored by estimator)
[lp-1 ] DEBUG 2025/10/13 12:02:36 soc estimated: 69.52% (vehicle: 68.00%)
[lp-1 ] DEBUG 2025/10/13 12:02:36 vehicle soc: 70%
[lp-1 ] ERROR 2025/10/13 12:02:36 vehicle soc limit: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token"
[lp-1 ] ERROR 2025/10/13 12:02:36 vehicle range: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token"
[lp-1 ] DEBUG 2025/10/13 12:02:37 pv charge current: 0A = 6A + -6.29A (1447W @ 1p)
[lp-1 ] DEBUG 2025/10/13 12:02:37 projected site power 1447W >= 1100W disable threshold
[lp-1 ] DEBUG 2025/10/13 12:02:37 pv disable in 1m15s
[lp-1 ] DEBUG 2025/10/13 12:02:37 pv disable timer remaining: 1m15s
[lp-1 ] DEBUG 2025/10/13 12:02:50 charge power: 1330W
[lp-1 ] DEBUG 2025/10/13 12:02:50 charge currents: [5.84 0 0]A
[lp-1 ] DEBUG 2025/10/13 12:02:52 charge voltages: [232 233 234]V
[lp-1 ] DEBUG 2025/10/13 12:02:52 detected active phases: 1p
[lp-1 ] DEBUG 2025/10/13 12:02:53 session energy: 0.962kWh
[lp-1 ] DEBUG 2025/10/13 12:02:53 charge total import: 5501.696kWh
[lp-1 ] DEBUG 2025/10/13 12:02:53 charger status: C
[lp-1 ] WARN 2025/10/13 12:02:53 vehicle soc: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token" (ignored by estimator)
[lp-1 ] DEBUG 2025/10/13 12:02:53 soc estimated: 69.53% (vehicle: 68.00%)
[lp-1 ] DEBUG 2025/10/13 12:02:53 vehicle soc: 70%
[lp-1 ] ERROR 2025/10/13 12:02:53 vehicle soc limit: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token"
[lp-1 ] ERROR 2025/10/13 12:02:53 vehicle range: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token"
[lp-1 ] DEBUG 2025/10/13 12:02:53 pv charge current: 0A = 6A + -6.34A (1458W @ 1p)
[lp-1 ] DEBUG 2025/10/13 12:02:53 projected site power 1458W >= 1100W disable threshold
[lp-1 ] DEBUG 2025/10/13 12:02:53 pv disable in 59s
[lp-1 ] DEBUG 2025/10/13 12:02:53 pv disable timer remaining: 59s
[lp-1 ] DEBUG 2025/10/13 12:03:05 charge power: 1328W
[lp-1 ] DEBUG 2025/10/13 12:03:06 charge currents: [5.84 0 0]A
[lp-1 ] DEBUG 2025/10/13 12:03:07 charge voltages: [232 233 234]V
[lp-1 ] DEBUG 2025/10/13 12:03:07 detected active phases: 1p
[lp-1 ] DEBUG 2025/10/13 12:03:08 session energy: 0.967kWh
[lp-1 ] DEBUG 2025/10/13 12:03:08 charge total import: 5501.702kWh
[lp-1 ] DEBUG 2025/10/13 12:03:08 charger status: C
[lp-1 ] WARN 2025/10/13 12:03:08 vehicle soc: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token" (ignored by estimator)
[lp-1 ] DEBUG 2025/10/13 12:03:08 soc estimated: 69.54% (vehicle: 68.00%)
[lp-1 ] DEBUG 2025/10/13 12:03:08 vehicle soc: 70%
[lp-1 ] ERROR 2025/10/13 12:03:08 vehicle soc limit: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token"
[lp-1 ] ERROR 2025/10/13 12:03:08 vehicle range: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token"
[lp-1 ] DEBUG 2025/10/13 12:03:08 pv charge current: 1.29A = 6A + -4.71A (1083W @ 1p)
[lp-1 ] DEBUG 2025/10/13 12:03:08 pv disable timer reset
[lp-1 ] DEBUG 2025/10/13 12:03:08 pv timer inactive
[lp-1 ] DEBUG 2025/10/13 12:03:20 charge power: 1329W
[lp-1 ] DEBUG 2025/10/13 12:03:20 charge currents: [5.83 0 0]A
[lp-1 ] DEBUG 2025/10/13 12:03:21 charge voltages: [232 232 234]V
[lp-1 ] DEBUG 2025/10/13 12:03:21 detected active phases: 1p
[lp-1 ] DEBUG 2025/10/13 12:03:22 session energy: 0.973kWh
[lp-1 ] DEBUG 2025/10/13 12:03:22 charge total import: 5501.707kWh
[lp-1 ] DEBUG 2025/10/13 12:03:22 charger status: C
[lp-1 ] WARN 2025/10/13 12:03:22 vehicle soc: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token" (ignored by estimator)
[lp-1 ] DEBUG 2025/10/13 12:03:22 soc estimated: 69.55% (vehicle: 68.00%)
[lp-1 ] DEBUG 2025/10/13 12:03:22 vehicle soc: 70%
[lp-1 ] ERROR 2025/10/13 12:03:22 vehicle soc limit: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token"
[lp-1 ] ERROR 2025/10/13 12:03:22 vehicle range: Get "https://api.volvocars.com/energy/v2/vehicles/VIN/state": oauth2: "invalid_grant" "unknown, invalid, or expired refresh token"

What type of operating system or environment does evcc run on?

Linux

External automation

  • [x] I have made sure that no external automation like HomeAssistant or Node-RED is active or accessing any of the mentioned devices when this issue occurs.

Nightly build

  • [x] I have verified that the issue is reproducible with the latest nightly build

Version

0.209.1

MartijnvanGeffen13 avatar Oct 13 '25 10:10 MartijnvanGeffen13

I have verified that the issue is reproducible with the latest nightly build

Not according to your log.

andig avatar Oct 13 '25 10:10 andig

I have verified that the issue is reproducible with the latest nightly build

Not according to your log.

Correct but that checkbox is mandatory, maybe make it a switch. or not mandatory , This bug is been in last few major versions ,seen it a few time now but forgot to create ticket , its also non breaking so low priority to me as a restart after change works to get it going.

As it takes 7 days to test is a nighly build that kinda not works here and by than a new build is ready .

Image

MartijnvanGeffen13 avatar Oct 13 '25 11:10 MartijnvanGeffen13

The checkbox is mandatory because the check is mandatory.

andig avatar Oct 13 '25 12:10 andig

This bug is been in last few major versions

Complete issues help reduce churn. Config is missing. It seems this is related to Volvo? There was a change in https://github.com/evcc-io/evcc/pull/23978, which was in 0.208.0. Is that when it went wrong?

/cc @lehmanju the PR should not have changed the token refresh afaikt. Do you have the same issue?

andig avatar Oct 13 '25 12:10 andig

not sure what version it started , been refreshing this usually during the evening ignoring the bug as a restart fixes it directly.

I only using the volvo connect since version 207.6 where everything was fixed for volvo 2 versions earlier. Seen we now dont need 3rd party anymore.

Kinda hoped the oauth fixes in 209.1 would fix it but looks like it did not.

so cant say since what version exactly this was starting but i have had this on all versions i migrated to since than. And seen i cant repo , but only see it during refresh once every week its hard to pinpoint or test in nightly version.

Happy to do some testing / debugging next week if you can share what might help locating the issue.

MartijnvanGeffen13 avatar Oct 13 '25 12:10 MartijnvanGeffen13

There was an intermediate issue, but that should have been fixed in 0.209.1.

@MartijnvanGeffen13 if you want to share it please send necessary credentials to [email protected], then I can debug what's going on. Token refresh is easy to provoke by setting the token's expiry date to "now".

andig avatar Oct 13 '25 13:10 andig

There was an intermediate issue, but that should have been fixed in 0.209.1.

@MartijnvanGeffen13 if you want to share it please send necessary credentials to [email protected], then I can debug what's going on. Token refresh is easy to provoke by settings the token's expiry date to "now".

cred sent , did need to send it via seperate emails so you have 5 .

let me know if you need anything else

MartijnvanGeffen13 avatar Oct 13 '25 14:10 MartijnvanGeffen13

Token refresh is easy to provoke by setting the token's expiry date to "now".

yeah thats true , but you wont see the errors as the old token is still valid when you do that so be mindfull when testing , you really to to validate which token its actually offering to the site, and if it actually does Seen the car is green for me something works but keep getting errors popup till i restart.

MartijnvanGeffen13 avatar Oct 13 '25 14:10 MartijnvanGeffen13

@lehmanju we're still looking into various logs. Are you aware if the Volvo Connected token has some sort of expiry associated with it (except after first use)?

andig avatar Oct 21 '25 13:10 andig

Yes, refresh token expires after 7 days. Reauth is necessary each time.

lehmanju avatar Oct 21 '25 14:10 lehmanju

@lehmanju

Do you see similair issues as i have, afther the 7 days you reauth via the evcc and afther the callback URL and EVCC turns green again, While succesfull renewed , for me it either throws errors as shown above refresh token is still invalid (Restart EVCC fixes it and after restart it directly communicates with volvo fine), Or it wont send out any call to Volvo anymore until restart.

Both error seem like that afther the renewal evcc still does not know it has the new tokens until it restarts.

MartijnvanGeffen13 avatar Oct 22 '25 07:10 MartijnvanGeffen13

@MartijnvanGeffen13 once your in that "after 7 days" state: did you try to logout via UI and login again? Even if we still don't understand how we get there, a restart should not be necessary!

andig avatar Oct 22 '25 08:10 andig

If you mean using the actual logout button itself in evcc , than no i never use that one , seen we are in the same LAN i allways close browser en start a new one.

MartijnvanGeffen13 avatar Oct 22 '25 08:10 MartijnvanGeffen13

I mean the Volvo Auth menu entry in evcc. It does login and logout both.

andig avatar Oct 22 '25 08:10 andig

Just upgraded to the latest Evcc Version, Refresh works without issues for me.

lehmanju avatar Oct 22 '25 10:10 lehmanju

@andig Today with the token chain invalidation and refresh i had no issues at all,

So either the circumstances are rare when it happens , lets just close this,

again really appreciate the support from your end. If you ever need anything from Volvo car to test let me know happy to help.

MartijnvanGeffen13 avatar Oct 28 '25 10:10 MartijnvanGeffen13