Kemmey / Kemmey-TeslaWatch-Public

40 stars 21 forks source link

Unable to use app #242

Closed OV10Driver closed 3 years ago

OV10Driver commented 3 years ago

I purchased the app in July, and up until a few days ago, it worked fine. I believe there was an update to the app and now I cannot use it at all. I’m using Apple Watch 3 with OS 7.2 and the watch for Tesla build 411. I’ve tried installing the companion IOS app on my iPhone XR, rebooting everything and uninstalling and reinstalling the watch for Tesla app on my watch. Nothing works. HELP!!

Kemmey commented 3 years ago

What error do you get? I need a bit more to go on than "does not work".

OV10Driver commented 3 years ago

The app no longer is connected to my car, and will not allow me to log in to Tesla. It keeps saying “Unable to acquire token unable to authenticate. Please ensure account is not locked out” I have logged in to my Tesla account using the same info that o entered into the app, but it will not go any further.

Sent from my iPhone

On Dec 17, 2020, at 2:58 PM, Kim Hansen notifications@github.com wrote:

 What error do you get? I need a bit more to go on than "does not work".

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

Kemmey commented 3 years ago

Are you logging in using the iOS companion app and tapping the "Login with Tesla" button? What exactly is the error message when you login after tapping that button?

After having completed a login in the iOS companion app, please tap the version number at the bottom of the window - that will show debug info about the login process. Please send a screenshot of that log.

OV10Driver commented 3 years ago

I tried the login to Tesla option first, but the screen never advances, then I tried the login with token option. Attached is the latest screenshot CBF2104F-C36D-4B44-B324-8A5A407CD35A

OV10Driver commented 3 years ago

Hit close by mistake

Kemmey commented 3 years ago

Hey,

I can reproduce this. I get 502 errors which basically means the Tesla server is unable to handle the authentication request right now.

I'll investigate further, but it appears they're having a bit of infrastructure issues right now.

I eventually was able to login by just tapping the login with Tesla button a couple times, waiting a bit in-between.

I'll add better handling in the app for when the Tesla servers are down - which they shouldn't ever be, but stuff happens...

Please keep trying and get back to me if completely unsuccessful.

OV10Driver commented 3 years ago

I’ve tried your suggestion 30-40 times with no luck.

On the watch, it goes to loading for about 2 seconds, then back to login.

On the IPhone, when I try your suggestion,the page goes blank for 1-2 seconds, then back to login.

I have other 3rd party Tesla apps that are operating correctly, so I don’t think the problem is with the Tesla server.

Sent from my iPhone

On Dec 17, 2020, at 9:42 PM, Kim Hansen notifications@github.com wrote:

 Hey,

I can reproduce this. I get 502 errors which basically means the Tesla server is unable to handle the authentication request right now.

I'll investigate further, but it appears they're having a bit of infrastructure issues right now.

I eventually was able to login by just tapping the login with Tesla button a couple times, waiting a bit in-between.

I'll add better handling in the app for when the Tesla servers are down - which they shouldn't ever be, but stuff happens...

Please keep trying and get back to me if completely unsuccessful.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

Kemmey commented 3 years ago

Please ignore the watch for now - logging in directly on the watch uses the old auth scheme, which is being phased out.

In the iOS app, when you tap the "Login with Tesla" do you get a pop up window, that is initially white, then quickly slides down again? If so, please afterwards tap the version label as before, scroll all the way to the bottom and send me a screenshot so I can see the errors.

Do not tap any other buttons. I need to see one reproducible flow of what happens doing just that and nothing else.

Kemmey commented 3 years ago

When you refer to other Tesla apps working correctly, have you logged out and back in to those as well? I was able to completely reproduce this by logging out and was unable to log back in, until after a few tries.

Also please note that the phone and watch are connected. Tapping login buttons on the watch will clear any tokens on both watch and phone and vice versa. That is why you should ignore the watch for now, as it does not have the ability to login with a web browser which is required for the modern login flow that supports multi factor authentication.

OV10Driver commented 3 years ago

Yes, I get the pop up white window. I’ve attached a screenshot of as far down as I can scroll. It extremely slow scrolling, and it seems to be repeating.

Sent from my iPhone

On Dec 17, 2020, at 10:27 PM, Kim Hansen notifications@github.com wrote:

 Please ignore the watch for now - logging in directly on the watch uses the old auth scheme, which is being phased out.

In the iOS app, when you tap the "Login with Tesla app" do you get a pop up window, that is initially white, then quickly slides down again? If so, please afterwards tap the version label as before, scroll all the way to the bottom and send me a screenshot so I can see the errors.

Do not tap any other buttons. I need to see one reproducible flow of what happens doing just that and nothing else.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

Kemmey commented 3 years ago

The log contains all events from past 12 hours. If you've tried a lot, it will contain a lot of events.

The screenshot has to be attached from GitHub - mail attachments for some reason do not go through. Your previous screenshot showed up correctly.

OV10Driver commented 3 years ago

I’m tired, and going to bed. I’ll start this again tomorrow. BTW, I’ve signed out of 2 3rd party apps and now I cannot log back in.

Sent from my iPhone

On Dec 17, 2020, at 10:45 PM, Kim Hansen notifications@github.com wrote:

 The log contains all events from past 12 hours. If you've tried a lot, it will contain a lot of events.

The screenshot has to be attached from GitHub - mail attachments for some reason do not go through. Your previous screenshot showed up correctly.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

Kemmey commented 3 years ago

Thank you so much for hanging in there with me! I know this is extremely frustrating.

Ping me when you're ready to pick this back up - I live in Denmark in GMT+1 so forgive me if I'm slow to answer given time zone differences.

OV10Driver commented 3 years ago

Back now. Tried other apps, no luck. Had to change password with Tesla. Did that, other apps loaded fine. Tried same with Watch for Tesla (with new password) still nothing-same error messages. Screen shot attached. 04DAAB94-3003-40E2-903A-979A7B7BDB9D

Kemmey commented 3 years ago

This seems like the issue from the initial MFA roll-out, where legacy authentication would instantly invalidate tokens issued to any other app. From what I can gather from the screenshot, the token is issued correctly, and renewed properly, but the Tesla API server still rejects it, even though it has just previously issued it, itself.

What I would REALLY like to see are any log lines that mention V2 or V3 - something like "Refresh token v2" or "Refresh token v3" - could you do me a favour and scroll through the list of debug output and grab a screenshot containing any of those lines. If the list is too long to scroll, you can reset it by re-installing the app.

That "The access token was revoked" message is the real issue at play. If you want a technical explanation, read below, if not, just ignore :-D

When logging in with the iOS app, the app will open a browser window to the Tesla website. You then log in there, and the website will return a login token to the app. The app never sees your username and password and supports multifactor authentication, making this flow very secure. The resulting token is called a V3 JWT token - this is a modern authentication token, used in most web services today. That token has two parts - a token and a refresh token - the refresh token can be used to issue a fresh token and refresh token. But the token-part will only work for 5 minutes - whereas the refresh token has no expiration except for when you change your password. In order to not have to request new tokens every five minutes using the refresh token, the app will use the v3 token to request the old v2 token. The v2 token is 64 characters long and is what you might have been used to using in other 3rd party apps that support token based login. With the introduction of MFA support, Tesla has deprecated V2 tokens - but they still function just fine. And they are valid for 45 days. So these are preferred by the app. If the V2 token should expire, the app will use the V3 token to issue a new V2 token and use that against the API.

At this point, my best guess is that the infrastructure problem that surfaced during initial MFA support roll-out has re-surfaced where basically the v2 and v3 Tesla servers are not in sync, and one will not trust tokens issued by the other - which is rather unfortunate.

I'll try to reproduce the error on my end and see if I can handle this specific case and come up with a workaround. In the mean time, please try and get the screenshot requested above showing mentions of V2 or V3. Possibly, try to use the watch to login again as well - that will strictly use the V2 endpoints - you can tap the same version label on the watch to see the authentication log there as well - screenshots from any v2/v3 mentions on the watch would also be relevant. Be aware that you have to either try logging in on the watch or on the phone - not both at the same time, as they will overwrite each other, causing all sorts of issues.

Kemmey commented 3 years ago

The absolute most important log-line to look for is this:

"Refresh token V4 success: True"

If you can grab a screenshot showing that line and as many of the lines after, that would be most helpful.

OV10Driver commented 3 years ago

I’ll try reinstalling the iOS app

Sent from my iPhone

On Dec 18, 2020, at 7:23 AM, Kim Hansen notifications@github.com wrote:

 This seems like the issue from the initial MFA roll-out, where legacy authentication would instantly invalidate tokens issued to any other app. From what I can gather from the screenshot, the token is issued correctly, and renewed properly, but the Tesla API server still rejects it, even though it has just previously issued it, itself.

What I would REALLY like to see are any log lines that mention V2 or V3 - something like "Refresh token v2" or "Refresh token v3" - could you do me a favour and scroll through the list of debug output and grab a screenshot containing any of those lines. If the list is too long to scroll, you can reset it by re-installing the app.

That "The access token was revoked" message is the real issue at play. If you want a technical explanation, read below, if not, just ignore :-D

When logging in with the iOS app, the app will open a browser window to the Tesla website. You then log in there, and the website will return a login token to the app. The app never sees your username and password and supports multifactor authentication, making this flow very secure. The resulting token is called a V3 JWT token - this is a modern authentication token, used in most web services today. That token has two parts - a token and a refresh token - the refresh token can be used to issue a fresh token and refresh token. But the token-part will only work for 5 minutes - whereas the refresh token has no expiration except for when you change your password. In order to not have to request new tokens every five minutes using the refresh token, the app will use the v3 token to request the old v2 token. The v2 token is 64 characters long and is what you might have been used to using in other 3rd party apps that support token based login. With the introduction of MFA support, Tesla has deprecated V2 tokens - but they still function just fine. And they are valid for 45 days. So these are preferred by the app. If the V2 token should expire, the app will use the V3 token to issue a new V2 token and use that against the API.

At this point, my best guess is that the infrastructure problem that surfaced during initial MFA support roll-out has re-surfaced where basically the v2 and v3 Tesla servers are not in sync, and one will not trust tokens issued by the other - which is rather unfortunate.

I'll try to reproduce the error on my end and see if I can handle this specific case and come up with a workaround. In the mean time, please try and get the screenshot requested above showing mentions of V2 or V3. Possibly, try to use the watch to login again as well - that will strictly use the V2 endpoints - you can tap the same version label on the watch to see the authentication log there as well - screenshots from any v2/v3 mentions on the watch would also be relevant. Be aware that you have to either try logging in on the watch or on the phone - not both at the same time, as they will overwrite each other, causing all sorts of issues.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

OV10Driver commented 3 years ago

I uninstalled the IOS app on my phone and reinstalled it. When I opened the app, the first kosher very briefly appeared, then went immediately to the page where it says “ login with Tesla “ and on the bottom “login with token” without inputting any login info , I pressed the version number and the error messages started flowing. It’s impossible to get a screenshot of the last one because they just keep flowing. None of them have anything that starts with V3

Sent from my iPhone

On Dec 18, 2020, at 7:26 AM, Kim Hansen notifications@github.com wrote:

 The absolute most important log-line to look for is this:

"Refresh token V4 success: True"

If you can grab a screenshot showing that line and as many of the lines after, that would be most helpful.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

OV10Driver commented 3 years ago

When I reinstalled the app, it shows that it is in the cloud. It never asks me to enter my login credentials. Is it possible the app has remembered my old Tesla login credentials? If so, how to completely erase your app? And then reinstall?

Sent from my iPhone

On Dec 18, 2020, at 7:26 AM, Kim Hansen notifications@github.com wrote:

 The absolute most important log-line to look for is this:

"Refresh token V4 success: True"

If you can grab a screenshot showing that line and as many of the lines after, that would be most helpful.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

Kemmey commented 3 years ago

It will remember your login across reinstalls, because the login is shared with the watch. If you input any jibberish in the login with token text field and tap login with token, it should log you out completely and you can then do a fresh re-install and use the login with Tesla option. I'll see if I can reproduce that state, because that's definitely a bug in the app.

OV10Driver commented 3 years ago

Should I delete the app from the watch before trying to reinstall in iOS?

Kemmey commented 3 years ago

It definitely won't hurt - and wait before reinstalling to the watch, until we've got the login properly working on your phone - that will also remove variance from the equation

OV10Driver commented 3 years ago

Ok, I don’t know what happened, as I was attempting to remove the watch app, the app started working. What to do now?

OV10Driver commented 3 years ago

The app on the watch started working, I’m reluctant to attempt the IOS app

Kemmey commented 3 years ago

Did you log into the watch app with username / password? Or did it just magically start working? I mean - if you only ever use the watch app, feel free to leave it at that, and we'll pick it up again later. But if you want to use the iOS widgets and stuff, and are up for it, I'd suggest to keep working it out :-D

Kemmey commented 3 years ago

Also - still of interest - on the watch, go to settings, scroll to bottom, tap show debug, scroll all the way to the bottom and grab a screenshot of any mention of v2, v3 or v4

OV10Driver commented 3 years ago

The watch app just suddenly started working. I didn’t do anything. I’ll try to get a screenshot of what you want

Kemmey commented 3 years ago

Btw, you're not alone in this - at least three others have reported similar issue. Something is definitely going on...

OV10Driver commented 3 years ago

When I do the steps you mentioned, the app is so slow to scroll the watch keeps timing out. I’ve attached the watch screenshot I got after 15 min of scrolling. It seems to duplicate what the iOS debug file was showing. I could never get to the very end. 8B39F871-3BA3-4E46-B6D1-EFE0D2649562

Kemmey commented 3 years ago

Thanks! If you could try again tomorrow - it should be much shorter, as it resets every 12 hours. Fingers crossed it remains logged in...

OV10Driver commented 3 years ago

Ok. I’ll try again tomorrow.

Kemmey commented 3 years ago

Hey - just had a few others with the same issue. One user got the app working by typing in a random word in the token field and tapping login with token. Wait a few seconds, then tap login with Tesla button. Could you install the iOS app again and try that and get back to me? If you're up for it :-D

OV10Driver commented 3 years ago

Strange things happening. I downloaded iOS app, and it immediately logged in when I opened it. No login information entered, no password, no nothing. Seems to be working fine.

Bill

Sent from my iPad

On Dec 18, 2020, at 11:31 AM, Kim Hansen notifications@github.com wrote:

 Hey - just had a few others with the same issue. One user got the app working by typing in a random word in the token field and tapping login with token. Wait a few seconds, then tap login with Tesla button. Could you install the iOS app again and try that and get back to me? If you're up for it :-D

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

Kemmey commented 3 years ago

Ok, that's because it's picking up your login from your watch. If you go to settings, scroll to bottom, tap show debug and scroll aaaaall the way to the bottom, you should hopefully see a message about v4 token refresh

Kemmey commented 3 years ago

Btw, app runs fine on iPad as well - useful with the widget :-D

OV10Driver commented 3 years ago

Ok, I did as suggested and attached a screenshot. No message about V4 token refresh. ![Uploading CE5C2623-0FBE-41E4-AC2C-5BCE46A3664B.png…]()

OV10Driver commented 3 years ago

I’ll just leave the app on the watch and phone. Won’t press my luck. Thanks for all your help. Signing off.