27.01.2022, 13:26
When you get new bearer token you need to exchange it for an access token as described here: https://tesla-api.timdorr.com/api-basics...cess-token
Your scheduled refresh script should work like this:
1. get current refresh_token from storage (you will have to store it manually once)
2. request new bearer_token and refresh_token using current refresh_token
3. exchange bearer_token for new access_token
4. save new access_token and new refresh_token to storage
All other API calls should use access_token from storage.
Your scheduled refresh script should work like this:
1. get current refresh_token from storage (you will have to store it manually once)
2. request new bearer_token and refresh_token using current refresh_token
3. exchange bearer_token for new access_token
4. save new access_token and new refresh_token to storage
All other API calls should use access_token from storage.