tesla icon indicating copy to clipboard operation
tesla copied to clipboard

Error: Need oauth credentials

Open RamEliC opened this issue 3 years ago • 41 comments

I updated to the latest version of the custom integration, generated the SSO keys using the "Tesla Tokens" app. When I type in my email address and paste the SSO key I get the following error:

Logger: custom_components.tesla_custom.config_flow Source: custom_components/tesla_custom/config_flow.py:167 Integration: Tesla Custom Integration (documentation, issues) First occurred: 6:13:13 PM (9 occurrences) Last logged: 7:42:54 PM

Authentication error: Need oauth credentials

I also tried using the API token as the email address just in case (but it didn't work either).

RamEliC avatar Sep 11 '21 23:09 RamEliC

The error indicates the token is invalid. Are you providing the SSO Refresh Token. It's the bottom item in Tesla Tokens.

alandtse avatar Sep 12 '21 00:09 alandtse

Can you verify the version of teslajsonpy on your system? It has to be 0.20 for this to work, and this error message is what you’ll get if you still have 0.18.3 installed.

You can see the version in the python site-packages folder.

Make sure the core Tesla component is removed, delete teslajsonpy from site-packages and then reactivate the custom component.

omelhus avatar Sep 12 '21 05:09 omelhus

I'm definitely using the SSO Refresh Token. I'm using the HA OS on a Raspberry Pi 4. I can't seem to figure out how to view the contents of the site-packages directory or the location of teslajsonpy to view/update the file (remotely). I haven't tried using the console yet though.

Googling wasn't much help sorry.

RamEliC avatar Sep 12 '21 12:09 RamEliC

First you can try logging onto the console and run

sudo -H pip install teslajsonpy -U

If that doesn’t help you can navigate to /usr/local/lib/python3.9/site-packages/ and remove the folders starting with teslajsonpy, restart and re-activate the component.

omelhus avatar Sep 12 '21 13:09 omelhus

I have the same issue and I try reinstalling teslajsonpy but it also doesn’t work…..

Ruy225 avatar Sep 12 '21 14:09 Ruy225

Please verify the version of teslajsonpy and alternatively try the second option from my above post.

This issue should disappear with the release of the next version of HA where the Tesla component is removed.

omelhus avatar Sep 12 '21 14:09 omelhus

Sorry, but myself also

2021-09-12 23:36:51 ERROR (MainThread) [custom_components.tesla_custom.config_flow] Authentication error: Need oauth credentials

I used AuthAppForTesla on iOS and copied the refresh token. Tried the Home Assistant iPhone App and Emailing the token then using Chrome on Windows I am running Home Assistant Operating System on a RPI4 core-2021.9.6 supervisor-2021.09.0 Home Assistant OS 6.3 HACS 1.15.2 Tesla v1.0.0

sw25481 avatar Sep 12 '21 22:09 sw25481

Unfortunately, there's not much we can debug on this beyond checking your dependencies. Tesla either accepts your token or it doesn't. Please note it should be over 1000 characters long, mine is 1240.

alandtse avatar Sep 13 '21 02:09 alandtse

Y’all need to try again when you’ve updated to HA without the Tesla component. Not sure when it’ll be released but it should be any day.

omelhus avatar Sep 13 '21 04:09 omelhus

Thought I have the same issue. @alandtse last comment helped me. I extracted my token via TeslaPy and always took the wrong too short refresh token. Now it works.

jmtatsch avatar Sep 13 '21 07:09 jmtatsch

I had the same issue.. Turns out I had to restart the HA instance twice before the old Tesla stuff would stop popping up & then the custom instance would work.

bdoooh avatar Sep 14 '21 00:09 bdoooh

It might be helpful if people could post a screenshot of the correct field in each app. Obviously obfuscate your token before posting. I'll get one for Tesla Tokens but I don't have an iPhone.

EDIT: image

alandtse avatar Sep 14 '21 00:09 alandtse

And if you're using TeslaFi you can grab the "Refresh Token (NEW)" from your Tesla account settings there too.

bdoooh avatar Sep 14 '21 00:09 bdoooh

89311B65-EB7B-4B31-9ECB-40F93A522EEC

omelhus avatar Sep 14 '21 03:09 omelhus

I had the same issue, installing the Tesla_custom integration for the first time (car arrives on friday) and unable to authenticate. Pulled my refresh token via ios Auth app for Tesla, its 1224 characters long. However everytime i put it in with my email address it showed invalid authentication. However after a restart of HA, it now logs in. I do have other errors now as it says the integration failed to set up but not started looking into that one just yet!

scottda4270 avatar Sep 14 '21 16:09 scottda4270

I had the same issue.. Turns out I had to restart the HA instance twice before the old Tesla stuff would stop popping up & then the custom instance would work.

This worked for me as well!

RamEliC avatar Sep 14 '21 16:09 RamEliC

the integration wont start now...says to check the logs. I dont have my Tesla till Friday and my Tesla account is not linked to my new car yet so dont know if thats the issue but i guess i wait till friday and wait to see. Will be frustrating to have the car but not be able to integrate it though. thanks

scottda4270 avatar Sep 14 '21 17:09 scottda4270

the integration wont start now...says to check the logs. I dont have my Tesla till Friday and my Tesla account is not linked to my new car yet so dont know if thats the issue but i guess i wait till friday and wait to see. Will be frustrating to have the car but not be able to integrate it though. thanks

Yes that's an issue. We don't test the integration against not having a vehicle linked to it. Until they hand it over, we have no idea what the state of the vehicle is and whether it'll reject your access attempts.

alandtse avatar Sep 14 '21 17:09 alandtse

I made it work. Thank you for all your efforts

I used AuthAppForTesla on iOS and copied the refresh token. I placed the Token in an Apple note I could read on my PC and then used Chrome on Windows 10 to configure

I am running Home Assistant Operating System on a RPI4 core-2021.9.6 supervisor-2021.09.0 Home Assistant OS 6.4 HACS 1.15.2 Tesla v1.0.0

The only thing that has changed since it did not work earlier in the week are OS is now v6.4, there have been a couple of reboots and I did not use the HomeAssistant iPhone App or email to transfer the token.

sw25481 avatar Sep 15 '21 13:09 sw25481

Set up matches the user above exactly:

RPI4 core-2021.9.6 supervisor-2021.09.0 Home Assistant OS 6.4 HACS 1.15.2 Tesla v1.0.0

"Invalid authentication" on attempted login with valid authentication.

number65259 avatar Sep 19 '21 17:09 number65259

Same error, Refresh Token is directly from the Tesla website via Chrome. Also tried with the iOS App. Not too sure what this teslajsonpy thing is as it's not referenced anywhere in the documentation.

Thanks for helping!

runshotgun avatar Sep 20 '21 05:09 runshotgun

Same error, Refresh Token is directly from the Tesla website via Chrome. Also tried with the iOS App. Not too sure what this teslajsonpy thing is as it's not referenced anywhere in the documentation.

Thanks for helping!

Use the apps as described. The token from the website is a different token (v1 vs v3) and cannot be used.

omelhus avatar Sep 20 '21 06:09 omelhus

ok this is quite strange. Mine is working but in the spirit of testing...just deleted my integration. Installed the integration again and all working (but did restart the supervisor after the reload). Just to double check, we are talking about the Tesla Custom integration and not the standard Tesla one right...the standard one is not working for me either but have also read thats not been working for a while now.

scottda4270 avatar Sep 20 '21 06:09 scottda4270

The two integrations cannot be installed alongside each other because of conflicting dependencies. If you have the core Tesla integration activated you need to remove that, restart a couple of times and then install the custom component.

If that doesn’t help just hang on until the version of HA where Tesla is removed is released, upgrade, reinstall and it should all be good.

omelhus avatar Sep 20 '21 06:09 omelhus

Just updated from 0.2.1 to 1.0.0, haven't used the builtin integration for a long time, and I'm having this issue too. Restarted 10 times and still won't work.

wencevdm avatar Sep 23 '21 13:09 wencevdm

I had this issue too, but realized it was because I was using my phone to copy and paste the token into HA. I pasted my token into a new note on my phone, and on my computer, copied the token from the note and pasted it into HA, and it worked!

dalcon007 avatar Sep 27 '21 02:09 dalcon007

I believe this is the same issue I am having. I just updated from the .2 to 1.0 and now the integration says "Failed to set up: could not authenticate".
How do I re-enter my credentials/token?

withanhdammit avatar Sep 27 '21 03:09 withanhdammit

Please wait for the October release of HA and upgrade to that before you add a “me too!”. The issue should be resolved as soon as Tesla is out of core.

omelhus avatar Sep 27 '21 04:09 omelhus

OK, thanks! I'll do that. I'm just sad because I lost all access to the Tesla component :-(

withanhdammit avatar Sep 28 '21 01:09 withanhdammit

Needs an HA instance restart and then it works. Choose the Refresh Token value! Thanks a bunch for working on this!!

premanandc avatar Sep 29 '21 02:09 premanandc