teslamate icon indicating copy to clipboard operation
teslamate copied to clipboard

Error: Tokens are invalid

Open jmnemonicj opened this issue 1 year ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

What happened?

I could not log in using the latest image (teslamate/teslamate:latest) and correct access and refresh tokens. I have tried 1.29.1 and 1.29.2-dev images. The message is always: "Error: Tokens are invalid " when trying to log in using http://192.168.1.x:4000/sign_in. The tokens are generated using Tesla Auth Win last version (https://github.com/adriankumpf/tesla_auth/releases/latest/download/tesla-auth-windows.tar.gz) My last sucessfull logns was 2 month ago. I am running locally, no public IP address.

Expected Behavior

Sucesfull log in

Steps To Reproduce

  1. create docket container using portainer and last image
  2. start container
  3. generate tokens using Win version: https://github.com/adriankumpf/tesla_auth/releases/latest/download/tesla-auth-windows.tar.gz
  4. try to log in at teslamate login page (http://192.168.1.x:4000/sign_in)

Relevant log output

2024-05-26 15:46:36.154 [info] Migrations already up

2024-05-26 15:46:37.435 [info] No tzdata release files found in custom data dir. Copying release file from tzdata priv dir.

2024-05-26 15:46:37.489 [info] System Info: Erlang/OTP 26 (jit)

2024-05-26 15:46:37.489 [info] Version: 1.29.2-dev

2024-05-26 15:46:42.509 [error] POST https://auth.tesla.com/oauth2/v3/token -> error: "timeout" (5005.503 ms)

2024-05-26 15:46:42.509 [warning] Token refresh failed: %TeslaApi.Error{reason: :token_refresh, message: "timeout", env: nil}

2024-05-26 15:46:42.509 [info] Scheduling token refresh in 7 min

2024-05-26 15:46:42.517 [info] Running TeslaMateWeb.Endpoint with cowboy 2.10.0 at :::4000 (http)

2024-05-26 15:46:42.517 [info] Access TeslaMateWeb.Endpoint at http://localhost

2024-05-26 15:46:45.949 [info] GET /sign_in

2024-05-26 15:46:45.959 [info] GET /

2024-05-26 15:46:45.959 [info] Sent 200 in 10ms

2024-05-26 15:46:47.519 [error] GET https://owner-api.teslamotors.com/api/1/products -> error: "timeout" (5001.446 ms)

2024-05-26 15:46:47.519 [warning] TeslaApi.Error / timeout

2024-05-26 15:46:47.519 [warning] Could not get vehicles: :unknown

2024-05-26 15:46:47.524 [warning] Using fallback vehicles:

[

  %TeslaApi.Vehicle{

    id: 929706692xxxxxx,

    vehicle_id: 1689126106xxxxxx,

    vin: "LRWYGCEK7xxxxxxxx",

    tokens: [],

    state: "unknown",

    option_codes: [],

    in_service: false,

    display_name: "Starship Y",

    color: nil,

    calendar_enabled: nil,

    backseat_token: nil,

    backseat_token_updated_at: nil,

    api_version: nil,

    charge_state: nil,

    climate_state: nil,

    drive_state: nil,

    gui_settings: nil,

    vehicle_config: nil,

    vehicle_state: nil

  }

]

2024-05-26 15:46:47.524 [info] Starting logger for 'Starship Y'

2024-05-26 15:46:47.528 [info] Sent 200 in 1568ms

2024-05-26 15:46:47.530 [info] MQTT connection has been established

2024-05-26 15:46:52.530 [error] GET https://owner-api.teslamotors.com/api/1/vehicles/929706692017144 -> error: "timeout" (5002.528 ms)

2024-05-26 15:46:52.530 [warning] TeslaApi.Error / timeout

2024-05-26 15:46:52.530 car_id=1 [error] Error / :unknown

Screenshots

obrázok

Additional data

No response

Type of installation

Docker

Version

v1.29.1

jmnemonicj avatar May 26 '24 16:05 jmnemonicj

Thanks for reporting. Please reboot your system, #3896 looks similar.

JakobLichterfeld avatar May 27 '24 09:05 JakobLichterfeld

Thanks for hint. The reboot is always the first thing to try and I have tried several times already before.

Unfortunatelly it doesn't work. I have tried to flush dns as well as reported in issue https://github.com/teslamate-org/teslamate/issues/3896 . There is no issue regarding dns lookup at my side.

Thanks once more

jmnemonicj avatar May 27 '24 13:05 jmnemonicj

same for me, fresh install, rebooting didn't help unfortunately yet.

shackrock avatar May 29 '24 18:05 shackrock

same for me

lnetto avatar May 30 '24 01:05 lnetto

Hi - I was getting similar error messages. On investigation I realised my teslamate container still had network settings pointing to a now deleted container as the primary DNS server. So the teslamate container couldn't resolve any URLs. Pretty basic error on my part, but posting here in case it can shine some light on the wider issue for others.

srainbow avatar Jun 02 '24 21:06 srainbow

Is this resolved @jmnemonicj ?

cwanja avatar Jun 19 '24 19:06 cwanja

Is this resolved @jmnemonicj ?

Unfortunatelly no, this is the fresh log:

2024-06-21 19:56:22.534 [info] Migrations already up

2024-06-21 19:56:23.805 [info] No tzdata release files found in custom data dir. Copying release file from tzdata priv dir.

2024-06-21 19:56:23.862 [info] System Info: Erlang/OTP 26 (jit)

2024-06-21 19:56:23.862 [info] Version: 1.29.2

2024-06-21 19:56:28.884 [error] POST https://auth.tesla.com/oauth2/v3/token -> error: "timeout" (5008.577 ms)

2024-06-21 19:56:28.884 [warning] Token refresh failed: %TeslaApi.Error{reason: :token_refresh, message: "timeout", env: nil}

2024-06-21 19:56:28.884 [info] Scheduling token refresh in 7 min

2024-06-21 19:56:28.903 [info] Running TeslaMateWeb.Endpoint with cowboy 2.10.0 at :::4000 (http)

2024-06-21 19:56:28.905 [info] Access TeslaMateWeb.Endpoint at http://localhost

2024-06-21 19:56:33.910 [error] GET https://owner-api.teslamotors.com/api/1/products -> error: "timeout" (5003.355 ms)

2024-06-21 19:56:33.910 [warning] TeslaApi.Error / timeout

2024-06-21 19:56:33.910 [warning] Could not get vehicles: :unknown

2024-06-21 19:56:33.915 [warning] Using fallback vehicles:

[

%TeslaApi.Vehicle{

id: 92x70x69x01x14x,

vehicle_id: 1x8x126x06x21x4x,

vin: "LRWxxxEx7xCx4x2xx",

tokens: [],

state: "unknown",

option_codes: [],

in_service: false,

display_name: "Starship Y",

color: nil,

calendar_enabled: nil,

backseat_token: nil,

backseat_token_updated_at: nil,

api_version: nil,

charge_state: nil,

climate_state: nil,

drive_state: nil,

gui_settings: nil,

vehicle_config: nil,

vehicle_state: nil

}

]

2024-06-21 19:56:33.915 [info] Starting logger for 'Starship Y'

2024-06-21 19:56:33.935 [info] MQTT connection has been established

2024-06-21 19:56:38.935 [error] GET https://owner-api.teslamotors.com/api/1/vehicles/9x97x66x20x71x4 -> error: "timeout" (5003.954 ms)

2024-06-21 19:56:38.935 [warning] TeslaApi.Error / timeout

2024-06-21 19:56:38.935 car_id=1 [error] Error / :unknown

When I tried to launch console, I got another error. How to check if dns is resolved correctly? I do not have/need any aditional DNS server.

Thanks.

jmnemonicj avatar Jun 21 '24 20:06 jmnemonicj

What device are you running TeslaMate on?

Are you able to access the internet from that device and from the container that runs TeslaMate?

cwanja avatar Jun 21 '24 20:06 cwanja

What device are you running TeslaMate on?

Are you able to access the internet from that device and from the container that runs TeslaMate?

The device is debian linux running docker and portainer and has access to the internet, of course: obrázok

obrázok

I could't launch the console for teslamate docker container, how to check the dns resolution for container itself? obrázok

thanks.

jmnemonicj avatar Jun 22 '24 07:06 jmnemonicj

Sorry, my fault, somehow the docker networks were misconfigured. I have added bridge network and everything works as expected.

jmnemonicj avatar Jun 22 '24 08:06 jmnemonicj