Securely generate API tokens for third-party access to your Tesla.
Securely generate API tokens for third-party access to your Tesla.
Securely generate API tokens for third-party access to your Tesla.
Supports MFA and Captcha through Tesla's native login flow.
❯ tesla_auth --help
Usage: tesla_auth [-d] [-c] [-v]
Tesla API tokens generator
Options:
-d, --debug print debug output
-c, --clear-browsing-data
clear browsing data at startup
-v, --version print the version and exit
--help, help display usage informationtesla_auth executable (either by double-clicking it or directly in a terminal)WebKit is native on macOS so no additional dependencies are required.
WebView2 provided by Microsoft Edge Chromium is used. So Windows 7, 8, 10 and 11 are supported.
WebKitGTK 4.1 is required for WebView and libxdo is used to make the predfined Copy, Cut, Paste and SelectAll menu items work. Ubuntu 22.04, Debian 12 and Fedora 36 are the earliest releases that ship WebKitGTK 4.1; on anything older neither the prebuilt binaries nor a local build will run.
So please make sure the following packages are installed:
sudo pacman -S webkit2gtk-4.1 xdotoolsudo apt install libwebkit2gtk-4.1-dev libxdo-devsudo dnf install gtk3-devel webkit2gtk4.1-devel xdotoolRun tesla_auth --debug first: it prints the URLs the webview navigates to, which is usually enough to tell where a flow gets stuck.
WebKitGTK's accelerated rendering paths misbehave on a number of drivers, the NVIDIA proprietary one in particular. Typical symptoms are Failed to create GBM buffer of size … or Error 71 (Protocol error) dispatching to Wayland display.
tesla_auth therefore disables the DMA-BUF renderer by default. If the window still does not come up, try:
WEBKIT_DISABLE_COMPOSITING_MODE=1 tesla_auth # turn off compositing entirely
GDK_BACKEND=x11 tesla_auth # run under XWayland
WEBKIT_DISABLE_DMABUF_RENDERER=0 tesla_auth # opt back into the default rendererStale cookies from a previous session are the usual cause. Start over with a clean profile:
tesla_auth --clear-browsing-dataAccess Denied — You don't have permission to access … on this serverThe request was rejected by Tesla's CDN before it ever reached the login page (the reference URL points at errors.edgesuite.net, i.e. Akamai). This is an IP reputation block rather than something tesla_auth can influence — disconnect from a VPN, or force a new public IP by power-cycling your router, and try again.
Error: Tokens are invalidThe tokens are pasted into TeslaMate, which then talks to auth.tesla.com itself. If that request fails, TeslaMate reports the tokens as invalid even though they are fine — check its logs for the actual error, and retry once Tesla's SSO endpoints are healthy again.
_TIPropertyValueIsValid called with 11 on nil context!Noise from the system input manager that any WebKit-based app produces. It has no effect on the login flow.
# Clone repository
git clone https://github.com/adriankumpf/tesla_auth
cd tesla_auth
# Build (debug version)
cargo build
# Install (release version)
cargo install --path . --lockedMIT
No open issues yet, or sync has not completed.