teslamate-org / teslamate

A self-hosted data logger for your Tesla 🚘
https://docs.teslamate.org
MIT License
5.75k stars 715 forks source link

Switching to Fleet API from current Owners API. Refersh Token mismatch issue #4091

Closed yangiak closed 1 month ago

yangiak commented 1 month ago

Is there an existing issue for this?

What happened?

I have set up a third-party account according to the Tesla Developer Website setup guide and granted the client relevant scope. I can also make API calls to the Fleet API endpoint with curl. When I try to implement the cutover(change the existing teslamate owners API to Fleet API) - Feed in environment variables below:

- TESLA_API_HOST=https://fleet-api.prd.na.vn.cloud.tesla.com/
- TESLA_AUTH_HOST=https://auth.tesla.com
- TESLA_AUTH_PATH=/oauth2/v3
- TESLA_AUTH_CLIENT_ID=<my client ID> 

Then restarted my instance. I see below error saying 'Invalid Client' I Tried to signed out from existing Tesla mate instance and feed in newly granted access code and refreshcode, it seems not like the 'NA_xxxxx' version of refresh token. What can I do here?

Relevant log output

teslamate-1  | 2024-07-17 21:36:07.724 [error] POST https://auth.tesla.com/oauth2/v3/token -> 401 (259.910 ms)
teslamate-1  | 2024-07-17 21:36:07.725 [warning] Token refresh failed: %TeslaApi.Error{
teslamate-1  |   reason: :token_refresh,
teslamate-1  |   message: nil,
teslamate-1  |   env: %Tesla.Env{
teslamate-1  |     method: :post,
teslamate-1  |     url: "https://auth.tesla.com/oauth2/v3/token",
teslamate-1  |     query: [],
teslamate-1  |     body: %{
teslamate-1  |       "error" => "invalid_client",
teslamate-1  |       "error_description" => "The 'client_id' between authorization code and refresh_token does not match. Include valid client_id in the request."

Type of installation

Docker

Version

1.30.1

cmilanf commented 1 month ago

It looks like this is the same issue as #4081.

JakobLichterfeld commented 1 month ago

[x] I have searched the existing issues

Unfortunately not.

It looks like this is the same issue as #4081.

Indeed, close as duplicate of #4081