bogosj / tesla

Provides a wrapper around the API to easily query and command a Telsa car.
Other
23 stars 18 forks source link

Fixed issue getting tesla token on username and password login #100

Closed evenmun closed 1 year ago

evenmun commented 1 year ago

Issue: #83

bogosj commented 1 year ago

I haven't used cmd/login in quite a while. When I run it with this PR I get the following:

go run . -o ~/tesla.token Username: b**@gmail.com Password: *** ✔ Passcode: 298871|

2023/05/19 01:30:36 verify: json decode: invalid character 'F' looking for beginning of value exit status 1

evenmun commented 1 year ago

That's strange. I will look into that, but can you provide me with some more information?

bogosj commented 1 year ago

I'm getting the following string:

"Found. Redirecting to /oauth2/v3/authorize/mfa/verify"

From this request: https://github.com/bogosj/tesla/blob/main/auth.go#L233

Edit: When it attempts to decode the JSON here: https://github.com/bogosj/tesla/blob/main/auth.go#L244 `

evenmun commented 1 year ago

Hey :) Are you able to test the changes again? The problem was the MFA verification request needed the _csrf token, and also, there was some issue decoding the MFA Verify response.

bogosj commented 1 year ago

Working now with MFA. Thanks for the contribution.