Closed FlyingLemming closed 2 years ago
Same here.
Login works with password, but not with API token.
I suppose homebridge-tesla is using mseminatore/TeslaJS for API access? It appears to me as if he has implemented some changes to the authenication procedure already in version 4.9.4 but there's also a pending pull request regarding this issue. Not sure whether this is already working. Maybe you could have a look into this?
Yes we're using TeslaJS, and I can't tell if it supports MFA yet. I spent some time the other day trying to rework the login stuff and implementing OAuth for refresh/access tokens but it got really complicated and I ended up throwing it out - plus the API started working again like it did before with plain username/password. I don't know if the characterization of the issue by the OP is necessarily correct; I think Tesla was just having some server issues.
I am afraid it‘s not just server issues. This behaviour still persists and it has been confirmed by numerous other users on the German TFF forum as well as several developers (TeslaFi, Tronity, ABRP, Watch for Tesla, Tesla Remote and a couple more).
Obviousely, the changes have only been gradually applied to the users by Tesla, therefore not everyone is affected yet. Those who are (and it seems to be a majority by now) still report the same issues.
All apps and services which have changed to the new login procedures (TeslaFi, Tronity, Watch for Tesla, ABRP) work together fine while all others are still disconnecting each other instantly and – even worse – are disconnected whenever one of the updated services makes any request to the API (which is at least once a minute for some of the beforementioned). Whenever the homebridge containing homebridge-tesla is (re-)started it only works for a couple of seconds, then it is gone.
Maybe the changes already implemented into TeslaJS 4.9.4 are enough to solve the issue. If not, I am quite confident that they will get it working soon. A lot of information on the issue can also be found on timdorr/tesla-api here on Git (https://github.com/timdorr/tesla-api/issues/215).
Best regards Jochen
Can you check to see if the latest update, which uses the updated TeslaJS library, has resolved the issue? If so, this can be closed.
Not quite, I'm afraid. 😬 No changes made to the config.json.
Feb 16 18:57:14 HomePi1 homebridge[10229]: [2/16/2021, 18:57:14] [Bruce] Logging into Tesla with username/password… Feb 16 18:57:17 HomePi1 homebridge[10229]: TeslaJS error: TypeError: Cannot read property 'forEach' of null Feb 16 18:57:17 HomePi1 homebridge[10229]: at /usr/local/lib/node_modules/homebridge-tesla/node_modules/teslajs/src/auth.js:51:26 Feb 16 18:57:17 HomePi1 homebridge[10229]: at tryCallOne (/usr/local/lib/node_modules/homebridge-tesla/node_modules/promise/lib/core.js:37:12) Feb 16 18:57:17 HomePi1 homebridge[10229]: at /usr/local/lib/node_modules/homebridge-tesla/node_modules/promise/lib/core.js:123:15 Feb 16 18:57:17 HomePi1 homebridge[10229]: at flush (/usr/local/lib/node_modules/homebridge-tesla/node_modules/asap/raw.js:50:29) Feb 16 18:57:17 HomePi1 homebridge[10229]: at processTicksAndRejections (internal/process/task_queues.js:79:11) Feb 16 18:57:17 HomePi1 homebridge[10229]: [2/16/2021, 18:57:17] [Bruce] Logging into Tesla with username/password… Feb 16 18:57:17 HomePi1 homebridge[10229]: TeslaJS error: TypeError: Cannot read property 'forEach' of null Feb 16 18:57:17 HomePi1 homebridge[10229]: at /usr/local/lib/node_modules/homebridge-tesla/node_modules/teslajs/src/auth.js:51:26 Feb 16 18:57:17 HomePi1 homebridge[10229]: at tryCallOne (/usr/local/lib/node_modules/homebridge-tesla/node_modules/promise/lib/core.js:37:12) Feb 16 18:57:17 HomePi1 homebridge[10229]: at /usr/local/lib/node_modules/homebridge-tesla/node_modules/promise/lib/core.js:123:15 Feb 16 18:57:17 HomePi1 homebridge[10229]: at flush (/usr/local/lib/node_modules/homebridge-tesla/node_modules/asap/raw.js:50:29) Feb 16 18:57:17 HomePi1 homebridge[10229]: at processTicksAndRejections (internal/process/task_queues.js:79:11) Feb 16 18:57:17 HomePi1 homebridge[10229]: [2/16/2021, 18:57:17] [Bruce] Logging into Tesla with username/password… Feb 16 18:57:18 HomePi1 homebridge[10229]: TeslaJS error: Error: Login credentials rejected Feb 16 18:57:18 HomePi1 homebridge[10229]: at /usr/local/lib/node_modules/homebridge-tesla/node_modules/teslajs/src/auth.js:92:19 Feb 16 18:57:18 HomePi1 homebridge[10229]: at tryCallOne (/usr/local/lib/node_modules/homebridge-tesla/node_modules/promise/lib/core.js:37:12) Feb 16 18:57:18 HomePi1 homebridge[10229]: at /usr/local/lib/node_modules/homebridge-tesla/node_modules/promise/lib/core.js:123:15 Feb 16 18:57:18 HomePi1 homebridge[10229]: at flush (/usr/local/lib/node_modules/homebridge-tesla/node_modules/asap/raw.js:50:29) Feb 16 18:57:18 HomePi1 homebridge[10229]: at processTicksAndRejections (internal/process/task_queues.js:79:11) Feb 16 18:57:18 HomePi1 homebridge[10229]: [2/16/2021, 18:57:18] [Bruce] Logging into Tesla with username/password… Feb 16 18:57:20 HomePi1 homebridge[10229]: TeslaJS error: Error: Login credentials rejected Feb 16 18:57:20 HomePi1 homebridge[10229]: at /usr/local/lib/node_modules/homebridge-tesla/node_modules/teslajs/src/auth.js:92:19 Feb 16 18:57:20 HomePi1 homebridge[10229]: at tryCallOne (/usr/local/lib/node_modules/homebridge-tesla/node_modules/promise/lib/core.js:37:12) Feb 16 18:57:20 HomePi1 homebridge[10229]: at /usr/local/lib/node_modules/homebridge-tesla/node_modules/promise/lib/core.js:123:15 Feb 16 18:57:20 HomePi1 homebridge[10229]: at flush (/usr/local/lib/node_modules/homebridge-tesla/node_modules/asap/raw.js:50:29) Feb 16 18:57:20 HomePi1 homebridge[10229]: at processTicksAndRejections (internal/process/task_queues.js:79:11)
v2.5.2 still works fine with the same config.json:
Feb 16 19:12:10 HomePi1 homebridge[14845]: [2/16/2021, 19:12:10] [Bruce] Logging into Tesla with username/password… Feb 16 19:12:10 HomePi1 homebridge[14845]: [2/16/2021, 19:12:10] [Bruce] Logging into Tesla with username/password… Feb 16 19:12:12 HomePi1 homebridge[14845]: [2/16/2021, 19:12:12] [Bruce] Got a login token. Feb 16 19:12:13 HomePi1 homebridge[14845]: [2/16/2021, 19:12:13] [Bruce] Using vehicle "Bruce" with state "online" Feb 16 19:12:13 HomePi1 homebridge[14845]: [2/16/2021, 19:12:13] [Bruce] Using vehicle "Bruce" with state "online" Feb 16 19:12:14 HomePi1 homebridge[14845]: [2/16/2021, 19:12:14] [Bruce] Using vehicle "Bruce" with state "online" Feb 16 19:12:15 HomePi1 homebridge[14845]: [2/16/2021, 19:12:15] [Bruce] Climate on? false
(Info: I created a separate account linked to my car just for homebridge-tesla a couple of weeks ago. Therefore, it does not interfere with the other apps and services and works fine again as long as Tesla does not shut down the old login completely.)
I was thinking... as I understand it, homebridge-tesla retrieves an access token with username/password and probably caches it somewhere. That might be the reason why 2.5.2 still works (with an exclusive account) as a valid token is still available somewhere. Could it be that 2.5.4 is now trying to use this old token, rather unsuccessfully? 🤔
2.5.2 finally stopped working for me.
This should be fixed by the latest version (3.0.1) - check the README for details!
Hi everyone,
it appears that Tesla is gradually changing the procedure for retrieving the token. For users already affected by this, the plugin does not work properly anymore and requires an update.
I have been experiencing severe issues with all services and apps using the Tesla API for the last two weeks. Only one service could be connected to the API at a time. Whenever another one logged itself in, all others were thrown out immediately – probably meaning that their tokens have been revoked. Only the official Tesla iOS app seemed to be independent, only showing a brief note „Session timed out“ and then loading normally.
Those are the apps and services I am using, and all of them were affected:
A couple of days ago, I received an interesting message from TeslaFi:
_We noticed that your TeslaFi account may have been affected by a recent change with Tesla’s authentication process. As you may know Tesla recently implemented a two factor authentication option on Tesla.com accounts. This new option created a different workflow for creating Tesla tokens which TeslaFi uses to obtain data from your vehicle.
It appears Tesla is slowly transitioning accounts to use only this new system and your account may have had this put in place.
We have implemented this new token generation workflow which will correct the issue. If you visit Settings->Tesla Account and select “Generate My Token” the issue with the tokens being unauthorized will be corrected._
After logging in again as described, TeslaFi seemed to operate independent of all other apps while those those still fought for access and threw each other out regularly. After contacting the Tronity developers, they changed the login procedure over night and Tronity worked fine as well. Watch for Tesla has also been updated a few days ago and is fine by now. ABRP still has some issues as it is immediately deactivated by homebridge-tesla or Tesla Remote but is at least able to peacefully co-exist with Tronity, TeslaFi and Watch for Tesla.
td;dr
The homebridge-tesla plugin needs an update to cope with the new login procedure. The change seems to be related to the introduction of multi-factor authentication at Tesla, though it also affects users who have not activated MFA yet. Unfortunately, I have no knowledge of the exact details of this new procedure. I am in contact with several other developers and will keep you posted in case I can get anything out of them.
Best regards, Jochen