Implement Tesla Fleet API refresh token handling correctly, including single-use rotation and the short grace window for token persistence failures
domain: developer.tesla.com · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
Steps
Store both the access token and refresh token immediately after the initial OAuth exchange, along with the access token's expiration time
Refresh the access token before its several-hour lifetime expires rather than waiting for a request to fail
Persist the new refresh token returned by every refresh call, since Tesla issues a new single-use refresh token on each exchange
Design your token storage to be atomic so a crash between receiving a new refresh token and saving it does not permanently lock you out, relying on the short grace window during which the previous refresh token still works
Alert on refresh failures promptly, since a refresh token that expires after months of inactivity requires the user to go through the authorization flow again
Known gotchas
Refresh tokens are single-use and rotate on every refresh call; reusing an old refresh token after it has already been exchanged will fail once its short grace window passes
If your integration goes unused long enough for the refresh token to expire, there is no silent recovery, you must re-run the full user authorization flow
Give your agent this knowledge — and 15,500+ more routes
One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?