There is already a nice little method on here using PHP created by MrTemple. I saw a few comments from people struggling to get it configured so I figured I'd document a simple step-by-step method using Python as an alternative.
*NOTE: This guide assumes Python is not already installed and Windows is your operating system. (These steps can be easily adjusted/followed on Linux and MacOS.)
If your Tesla account has MFA enabled:
If your Tesla account does not have MFA enabled:
-u = Tesla account email
-p = Tesla account password
-c = Passcode generated by your authenticator app
MFA example:
Non-MFA example:
*NOTE: This guide assumes Python is not already installed and Windows is your operating system. (These steps can be easily adjusted/followed on Linux and MacOS.)
PREREQUISITES:
- Python 3.x (Download Python)
- ChromeDriver (http://chromedriver.storage.googleapis.com/index.html) (select the version that matches your Chrome version)
- auth.tokens.py (https://raw.githubusercontent.com/teslascope/tokens/master/auth.tokens.py)
- requirements.txt (enode-engineering/tesla-oauth2) -OR- create a text file named “requirements.txt” and add the following two lines:
Code:requests==2.24.0 selenium==3.141.0
STEPS:
- Download the prerequisites
- Create a project folder to store your files; e.g., “C:\Users\Username\Desktop\TeslaTokens”
- Place: ChromeDriver, auth.tokens.py, and requirements.txt in “C:\Users\Username\Desktop\TeslaTokens”
- Install Python FOR ALL USERS and add to PATH (If you need help installing Python there are plenty of great videos out there explaining the process for each system)
- Launch a command window/terminal (e.g., PowerShell, Command Prompt, Terminal, etc.)
- Type:
Code:
CD C:\Users\Username\Desktop\TeslaTokens
- Press: ENTER
- Type:
Code:
pip install -r requirements.txt
- Press: ENTER
- At this point everything should be installed, configured and ready to go
- Then enter one of the below strings at the command prompt and hit ENTER:
If your Tesla account has MFA enabled:
Code:
python3 ./auth.tokens.py -u 'email' -p 'password' -c 'passcode'
If your Tesla account does not have MFA enabled:
Code:
python3 ./auth.tokens.py -u 'email' -p 'password'
-u = Tesla account email
-p = Tesla account password
-c = Passcode generated by your authenticator app
MFA example:
Code:
python3 ./auth.tokens.py -u [email protected] -p someSuperSecurePassword -c 123456
Non-MFA example:
Code:
python3 ./auth.tokens.py -u [email protected] -p someSuperSecurePassword
TIPS:
- If python3 does not work try using just python
- To check your Python install you can type:
Code:
python --version