Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use OAuth2.0 v3 Authentication #6

Open
JakobLichterfeld opened this issue Jan 30, 2021 · 10 comments
Open

Use OAuth2.0 v3 Authentication #6

JakobLichterfeld opened this issue Jan 30, 2021 · 10 comments
Labels
bug Something isn't working enhancement New feature or request help wanted Extra attention is needed

Comments

@JakobLichterfeld
Copy link
Owner

see https://tesla-api.timdorr.com/api-basics/authentication

@JakobLichterfeld JakobLichterfeld added bug Something isn't working enhancement New feature or request help wanted Extra attention is needed labels Jan 30, 2021
@MikeBishop
Copy link

FWIW, I think if there's a way to have a web view in Tasker, you might be able to do the same thing the Tesla app now does - launch the starting URL and watch for the web view to hit the fake result URL. I don't know Tasker well enough to know if that's possible.

@tony06077
Copy link

Would you create a 'auth.tesla.cn' profile for me?

@JakobLichterfeld
Copy link
Owner Author

Hopefully find the time to do so. Pull requests are welcome too 😉

@lLarryLaffer
Copy link

Is there an easy workaround to bypass the
{"response":null,"error":"Endpoint deprecated"...} message from the
"Tesla API Token Get/Refresh/Valid"-Task?

@MikeBishop
Copy link

@lLarryLaffer, there's not. This profile uses the old auth endpoint, so until it's updated, there's not much to do.

@JakobLichterfeld
Copy link
Owner Author

As an update, as I found some time yesterday:
I was able to generate the code_verifier and the SHA256 code_challenge with the help of JavaScript and Crypto-JS Library. The rest should be straight forward. So there is light at the end of the tunnel.

@JakobLichterfeld JakobLichterfeld changed the title Use OAuth2.0 Authentication Use OAuth2.0 v3 Authentication Jun 15, 2021
@JakobLichterfeld
Copy link
Owner Author

JakobLichterfeld commented Jun 15, 2021

Is there an easy workaround to bypass the
{"response":null,"error":"Endpoint deprecated"...} message from the
"Tesla API Token Get/Refresh/Valid"-Task?

@lLarryLaffer: As a workaround you can directly set the %Tesla_token under VARS to a valid token (generated by python script on pc or whatever) and set %Tesla_token_expires_in to 9999999999999999 until I updated the code

@JakobLichterfeld
Copy link
Owner Author

JakobLichterfeld commented Jun 15, 2021

As an update, as I found some time yesterday evening:
Finally, I was able to do the same steps as the official Tesla App does, and find the hidden input fields. Now struggeling with easy way of export _csrf, _phase, _process, transaction_id, and cancel values. Looking into the new HTML/XML Reading feature. --> Only a matter of time

@rubin110
Copy link

rubin110 commented Aug 9, 2021

Curious if this is in the current play store build now? I've got my access and refresh tokens. Sticking both in the OAuth Token and OAuth Refresh Token fields throws up an error. I can put the access token in the Access Token field but I'm guessing it's ignoring the Refresh Token field at that point?

@JakobLichterfeld
Copy link
Owner Author

JakobLichterfeld commented Aug 9, 2021

Hi Rubin,

Curious if this is in the current play store build now?

Tesla API in Tasker is not listed in the Google play store, only GitHub and Taskernet

I've got my access and refresh tokens. Sticking both in the OAuth Token and OAuth Refresh Token fields throws up an error. I can put the access token in the Access Token field but I'm guessing it's ignoring the Refresh Token field at that point?

As wrote above: you need to set %Tesla_token_expires_in to 9999999999999999 for current workaround, and yes refresh token is also broken in current version, due to the Oath V3 update by Tesla.

Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants