Giter Club home page Giter Club logo

tesla_auth's Introduction

Tesla Auth

CI CD

Securely generate API tokens for third-party access to your Tesla.

Multi-factor authentication (MFA) and Captcha are supported.

Download

Precompiled binaries are currently only available for x86-64.

Usage

❯ tesla_auth --help
Usage: tesla_auth [-d] [-k]

Tesla API tokens generator

Options:
  -d, --debug       print debug output
  -c, --clear-browsing-data
                    clear browsing data at startup
  --help            display usage information

Steps

  1. Run the tesla_auth executable (either by double-clicking it or directly in a terminal)
  2. Enter your Tesla account credentials (and MFA code if necessary)
  3. You'll get a final window where you can select and copy the access token and refresh token

Platform-specific dependencies

macOS

WebKit is native on macOS so no additional dependencies are required.

Windows

WebView2 provided by Microsoft Edge Chromium is used. So Windows 7, 8, 10 and 11 are supported.

Linux

WebKitGTK is required for WebView and libxdo is used to make the predfined Copy, Cut, Paste and SelectAll menu items work. So please make sure the following packages are installed:

Arch Linux / Manjaro:

sudo pacman -S webkit2gtk-4.1 xdotool

Debian / Ubuntu:

sudo apt install libwebkit2gtk-4.1-dev libxdo-dev

Fedora

sudo dnf install gtk3-devel webkit2gtk4.1-devel xdotool

Development

# Clone repository
git clone https://github.com/adriankumpf/tesla_auth
cd tesla_auth

# Build (debug version)
cargo build

# Install (release version)
cargo install --path . --locked

License

Apache-2.0/MIT

tesla_auth's People

Contributors

adriankumpf avatar dependabot[bot] avatar enoch85 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tesla_auth's Issues

Build instructions

Thanks for the tool! - can you please provide build instructions so this can be compiled locally?

Windows 10: WebView2 error. The parameter is incorrect

Running both by double-clicking and in terminal (both CMD and PowerShell) results in an instant crash and the following error message:

PS C:\Users\Gasur\Downloads\tesla auth> ./tesla_auth.exe
Error: WebView2 error: WindowsError(Error { code: 0x80070057, message: The parameter is incorrect. })

Installation of Edge Canary nor Edge Dev does not work.

can't compile in ubuntu focal ?

Hi,

I tried to compil but i have dependency error :

root@virtuabox:/usr/src/teslamate/tesla_auth# cargo install --path . --locked
  Installing tesla_auth v0.6.2 (/usr/src/teslamate/tesla_auth)
    Updating crates.io index
   Compiling pkg-config v0.3.26
   Compiling serde v1.0.152
   Compiling smallvec v1.10.0
   Compiling heck v0.4.1
   Compiling cfg-expr v0.11.0
   Compiling version-compare v0.1.1
   Compiling libc v0.2.139
   Compiling autocfg v1.1.0
   Compiling proc-macro2 v1.0.51
   Compiling quote v1.0.23
   Compiling unicode-ident v1.0.6
   Compiling syn v1.0.107
   Compiling cfg-if v1.0.0
   Compiling version_check v0.9.4
   Compiling once_cell v1.17.1
   Compiling thiserror v1.0.38
   Compiling memchr v2.5.0
   Compiling pin-project-lite v0.2.9
   Compiling futures-core v0.3.26
   Compiling toml v0.5.11
   Compiling slab v0.4.8
   Compiling system-deps v6.0.3
   Compiling futures-task v0.3.26
   Compiling glib-sys v0.16.3
   Compiling gobject-sys v0.16.3
The following warnings were emitted during compilation:

warning: `"pkg-config" "--libs" "--cflags" "glib-2.0" "glib-2.0 >= 2.70"` did not exit successfully: exit status: 1

error: failed to run custom build command for `glib-sys v0.16.3`

Caused by:
  process didn't exit successfully: `/usr/src/teslamate/tesla_auth/target/release/build/glib-sys-a17a72efef8e5f33/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=GLIB_2.0_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:warning=`"pkg-config" "--libs" "--cflags" "glib-2.0" "glib-2.0 >= 2.70"` did not exit successfully: exit status: 1
  error: could not find system library 'glib-2.0' required by the 'glib-sys' crate

  --- stderr
  Requested 'glib-2.0 >= 2.70' but version of GLib is 2.64.6

warning: build failed, waiting for other jobs to finish...
error: failed to compile `tesla_auth v0.6.2 (/usr/src/teslamate/tesla_auth)`, intermediate artifacts can be found at `/usr/src/teslamate/tesla_auth/target`

i dont found a way to install glib 2.70 + ...

Thanks

Guldil

Move to the new teslamate-org organisation?

Found out today that there was a new release. I used this repo to authenticate again (I thought that was causing my issues). And when seeing the new organisation being out there, maybe an idea to move this repository to there as well? Since it's sort-of related

Invisible text in entry fields on macOS

When entering any information on a dialog window (email, password, 2fa code), the typed text is not visible. The app still fetches tokens OK, but it's a weird feeling not seeing what I've typed.

cargo 1.62.0
macOS Big Sur version 11.6.7
MacBook Pro (16-inch, 2019)
Processor 2.3 GHz 8-Core Intel Core i9
Memory 64 GB 2667 MHz DDR4
Graphics AMD Radeon Pro 5500M 4 GB/Intel UHD Graphics 630 1536 MB

How to compile

First off thank you for all of the work you've done with Teslamate and Tesla Auth. Amazing!

I would like to compile your Tesla Auth code myself and then run it but alas I'm not knowledgeable enough to know how to carry out this task. I can use Mac, Windows, or RPi so whichever one of these platform is easiest will work. Would you be so kind as to let me know what I would need to do to compile your code and create the executable myself? Is it as simple as just downloading the three .rs files (auth, htime, and main) into a directory and then running rustc main.rs within that directory?

Thank you for your time and help.

Terminating app due to uncaught exception 'NSInvalidArgumentException' on macOS

Happens when clicking the captcha images. Crashes out and gives me this :

2021-10-26 20:41:07.935 tesla_auth[58475:659920] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[15]'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007ff806e88e5b __exceptionPreprocess + 242
	1   libobjc.A.dylib                     0x00007ff806be9b9d objc_exception_throw + 48
	2   CoreFoundation                      0x00007ff806f44404 _CFThrowFormattedException + 202
	3   CoreFoundation                      0x00007ff806f4ec71 -[__NSPlaceholderDictionary initWithCapacity:].cold.1 + 0
	4   CoreFoundation                      0x00007ff806d97e62 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 251
	5   CoreFoundation                      0x00007ff806d97d4d +[NSDictionary dictionaryWithObjects:forKeys:count:] + 49
	6   VisionKitCore                       0x00007ffb1605c9d1 -[VKAnalyticsAnalyzerEvent coreAnalyticsDictionary] + 1292
	7   VisionKitCore                       0x00007ffb1602007c -[VKAnalyticsProcessor processAndSendEvent:] + 96
	8   VisionKitCore                       0x00007ffb160164b6 __69-[VKImageAnalyzer _processRequest:progressHandler:completionHandler:]_block_invoke_2 + 1254
	9   libdispatch.dylib                   0x00007ff806b8ead8 _dispatch_call_block_and_release + 12
	10  libdispatch.dylib                   0x00007ff806b8fcc9 _dispatch_client_callout + 8
	11  libdispatch.dylib                   0x00007ff806b95cee _dispatch_lane_serial_drain + 696
	12  libdispatch.dylib                   0x00007ff806b967c8 _dispatch_lane_invoke + 366
	13  libdispatch.dylib                   0x00007ff806ba07e1 _dispatch_workloop_worker_thread + 758
	14  libsystem_pthread.dylib             0x00007ff806d4308f _pthread_wqthread + 326
	15  libsystem_pthread.dylib             0x00007ff806d4201b start_wqthread + 15
)
libc++abi: terminating with uncaught exception of type NSException
[1]    58475 abort      tesla_auth```

This is git cloned, not the binary.

rustc 1.56.0 (09c42c458 2021-10-18)

tesla_auth not working

After I put the tesla_auth exec in usr/sbin and ran it with debug, I got this output:

"DEBUG [tesla_auth] Opening https://auth.tesla.com/oauth2/v3/authorize?response_type=code&client_id=ownerapi&state=VLIec3u_cwFwfBwNqx64Wg&code_challenge=ZqInBtaFTozJb6PtcBOh9L9VhOIPvtYqM75zMLZ_KGQ&code_challenge_method=S256&redirect_uri=https%3A%2F%2Fauth.tesla.com%2Fvoid%2Fcallback&scope=openid+email+offline_access ...

(process:20614): GLib-GIO-WARNING **: 09:58:59.304: ../../../gio/gtlsconnection.c:429: invalid property id 12 for "protocol-version" of type 'GParamEnum' in 'GTlsClientConnectionGnutls'

(process:20614): GLib-GIO-WARNING **: 09:58:59.305: ../../../gio/gtlsconnection.c:429: invalid property id 13 for "ciphersuite-name" of type 'GParamString' in 'GTlsClientConnectionGnutls'

DEBUG [tesla_auth] URL changed: about:blank." Also, in the gui that was generated, it said "could not parse http response."

If it helps, I am using a Acer Spin 11 chromebook with chrome os, and I installed the linux terminal as debian bookworm.
Please help me with this issue.

Running on Raspberry Pi

I pulled down the Linux version and was trying to run it on my Pi (same Pi that is running teslamate).

Are there any dependencies need to run this on Raspbian (buster)?

root@teslamate:~# ./tesla_auth -d
-bash: ./tesla_auth: cannot execute binary file: Exec format error
root@teslamate:~# file tesla_auth
tesla_auth: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=615abbf214c7145a0027183d8afcb869dccf209c, for GNU/Linux 3.2.0, stripped

Build fails

Cloned repo and ran cargo build on same RPi that Teslamate is installed on.

Got the following errors and build failed:
Capture

Segmentation fault

I'm getting a segmentation fault error while running tesla_auth on MacOS Ventura running on a 2015 MacbookPro (x86-64).

Any hint on what might be the issue? Is there anything I can provide to help finding the cause?

Bearfoos defender alert

I used the tool and got an alert from Windows Defender about Bearfoos malware running. Is this intended?

Blank application window (0.7.0 / Windows 11)

Using tesla_auth 0.7.0 on fully up to date Windows 11 results in a blank application window.

Windows 11 Pro / 22H2
Build: 22621.1702
Windows Feature Experience Pack 1000.22641.1000.0

Edge: Version 113.0.1774.42 (Official build) (64-bit)

Using version 0.6.3 on the system above works fine.

Running on Windows 10

I tried running this on my WIndows 10 PC and get this:

C:\Users\myid\Desktop>tesla_auth.exe -d
Error: webview2 error, HRESULT 0x80070002

I'll poke around some more as I'm wondeirng if I need to install WebView2. I have a pretty standard install of Windows 10 though and use Firefox as my default browser.

Page Not Found

After authenticating with the mfa, the app left me with a white window with "Page Not Found" -- has Tesla changed something recently?

I got that originally from the mac binary I downloaded and ran (ARM Mac), but it happened even after building the binary myself -- actually when I ran the binary I built, it went straight to that "Page Not Found" screen.

Loads infinitely if two MFA devices are added

When two MFA devices are added within the tesla site, the loader is stuck for the 30 seconds and then the login reappears.

As soon as I removed one of the MFA devices, the tesla_auth app seemed to work as expected, asking for the MFA token.

HTTP status client error (401 Unauthorized) for url (https://owner-api.teslamotors.com/oauth/token)

I created 8h tokens just fine, then I stumbled upon this

./tesla_auth -d --owner-api-token
DEBUG [tesla_auth] Opening https://auth.tesla.com/oauth2/v3/authorize?response_type=code&client_id=ownerapi&state=
XXXXXXXXX&code_challenge_method=S256&redirect_uri=https%3A%2F%2Fauth.tesla.com%2Fvoid%2Fcallback&scope=openid+email+offline_access ...
DEBUG [tesla_auth] URL changed: https://auth.tesla.com/void/callback?code=XXXXXXXXX&state=YYYYYYYY&issuer=https%3A%2F%2Fauth.tesla.com%2Foauth2%2Fv3
DEBUG [reqwest::connect] starting new connection: https://auth.tesla.com/
DEBUG [reqwest::async_impl::client] response '200 OK' for https://auth.tesla.com/oauth2/v3/token
DEBUG [reqwest::connect] starting new connection: https://owner-api.teslamotors.com/
DEBUG [reqwest::async_impl::client] response '401 Unauthorized' for https://owner-api.teslamotors.com/oauth/token
ERROR [tesla_auth] HTTP status client error (401 Unauthorized) for url (https://owner-api.teslamotors.com/oauth/token)

I guess it makes no difference but I downloaded latest release (today) and run on Mac with M1 chipset, maybe Tesla changed it's API?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.