Created
January 12, 2021 06:17
-
-
Save jamesmartin/686a8d861111703e0143c8eee49d2c86 to your computer and use it in GitHub Desktop.
Fetches a new OAuth 2.0 token from the Tesla API using the email and password of a Tesla account
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Fetches a new OAuth 2.0 token from the Tesla API using email and password of | |
# a Tesla account. | |
CLIENT_ID=81527cff06843c8634fdc09e8ac0abefb46ac849f38fe1e431c2ef2106796384 | |
CLIENT_SECRET=c7257eb71a564034f9419ee651c7d0e5f7aa6bfbd18bafb5c5c033b093bb2fa3 | |
GRANT_TYPE=password | |
while getopts e:p: option | |
do | |
case "${option}" | |
in | |
e) EMAIL=${OPTARG};; | |
p) PASSWORD=${OPTARG};; | |
esac | |
done | |
if [ -z ${PASSWORD+x} ]; then | |
read -p "Email: " EMAIL | |
read -sp "Password: " PASSWORD | |
echo | |
fi | |
curl -XPOST https://owner-api.teslamotors.com/oauth/token -d "password=$PASSWORD&email=$EMAIL&client_secret=$CLIENT_SECRET&client_id=$CLIENT_ID&grant_type=$GRANT_TYPE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Endpoint is now deprecated I think