Skip to content

Refreshing an access token using sso refresh token (Not working?) #503

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

Closed
TeslaOwnerTips opened this issue Dec 25, 2021 · 11 comments
Closed

Comments

@TeslaOwnerTips
Copy link

TeslaOwnerTips commented Dec 25, 2021

https://auth.tesla.com/oauth2/v3/token
The SSO refresh token I'm using is valid based on it being used by two homebridge plugins and TeslaFi.
It was generated using the AuthforTesla ios app.

The error is

You don't have permission to access "http://auth.tesla.com/oauth2/v3/token" on this server.

I tested what was being received using httpbin running locally in docker.
Note: The key I show below is not an actual key.

"headers": {
"Accept": "/",
"Content-Length": "1341",
"Content-Type": "application/json",
"Host": "192.168.1.11",
"User-Agent": "curl/7.74.0"
},
"json": {
"client_id": "ownerapi",
"grant_type": "refresh_token",
"refresh_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Ilg0RmNua0RCUVBUTnBrZTZiMnNsdgdsgtL29hdXRoMi92MyIsImF1ZCI6Imh0dHBzOi8vYXV0aC50ZXNsYS5jb20vb2F1dGgyL3YzL3Rva2VuIiwiaWF0IjoxNjM1OdfgzdgIjoiMSIsImF1ZCI6Imh0dHBzOi8vb3duZXItYXBpLnRlc2xhbWzdfgzgZWUtOTBhYS02MzUzNWFjMmY2ZDkiLCJzY3AiOlsib3BlbmlkIiwiZW1haWwiLCJvZmZsaW5lX2FjY2VzcyJdLCJhenAiOiJvd25lcmFwaSIsImFtciI6WyJwd2QiXSwiYXV0aF90aW1lIjoxNjM1ODk2ODUwfX0.Q_6IBtXPzRojESWY28mq4tmhzo8q60gHDGn4UnhH32_Pt-2Ejz6d3gCZEQYgokw9D9mbBUEASCdkbUmyRFm3xcvseGigOqPm2diAdu8v4CwRPwtNlRsfWXqawl3M7Sajba8hVwiV2P6Pca_mwNb4U58NXP5VylYnjcOLMwOM2O9dikDxUgH24Zi4UvapDMJq-oIY1p8gD8yLhqVMpw67ckNsq2nGiC3BYL2ZxzVUOzZgQiygjtbNMRuoilFCHMsu4JViLhW_b2Eav3w8V2ZZcu21PvKALzSS0y3g_XFyVu4O1CgQPzxvbzxvTjiWQChU7zdk1eZcTJ-Gy_7g_H7cqPrhy3EG-vhgbqxS_hn_Im1gqR9ln1zuTV_OwPJyZMxvM52_TBmOIGt7aOfKR6kZlzUefbLYCEPcCfqggoX69WUIGQXG1wliaai2bRRfESDcc8OFO03xxOInxQBj6RCA1v-YcN8tO9TDejsSWh6EKk4AUG77iD4A5eNtmcMP-F3vWcwlXYFs3tVtPrCyz3psvmCCFN1KM7Vbgjm9P4in_Yx_hpqm-Ttlluql7bkTjYXt1VT7UUQnGrS6n97de47uXgnXIjrw5WMsLhQq3wOLLjoilBk7GDjao9j2UxtbhI",
"scope": "openid email offline_access"
},
"origin": "172.17.0.1",
"url": "http://192.168.1.11/post"

Note: NOT the actual key.

The command used was

curl -X POST -H 'Content-Type: application/json' -d "{\"grant_type\": \"refresh_token\", \"client_id\": \"ownerapi\", \"refresh_token\": \"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Ilg0RmNua0RCUVBUTnBrZTZiMnNsdgdsgtL29hdXRoMi92MyIsImF1ZCI6Imh0dHBzOi8vYXV0aC50ZXNsYS5jb20vb2F1dGgyL3YzL3Rva2VuIiwiaWF0IjoxNjM1OdfgzdgIjoiMSIsImF1ZCI6Imh0dHBzOi8vb3duZXItYXBpLnRlc2xhbWzdfgzgZWUtOTBhYS02MzUzNWFjMmY2ZDkiLCJzY3AiOlsib3BlbmlkIiwiZW1haWwiLCJvZmZsaW5lX2FjY2VzcyJdLCJhenAiOiJvd25lcmFwaSIsImFtciI6WyJwd2QiXSwiYXV0aF90aW1lIjoxNjM1ODk2ODUwfX0.Q_6IBtXPzRojESWY28mq4tmhzo8q60gHDGn4UnhH32_Pt-2Ejz6d3gCZEQYgokw9D9mbBUEASCdkbUmyRFm3xcvseGigOqPm2diAdu8v4CwRPwtNlRsfWXqawl3M7Sajba8hVwiV2P6Pca_mwNb4U58NXP5VylYnjcOLMwOM2O9dikDxUgH24Zi4UvapDMJq-oIY1p8gD8yLhqVMpw67ckNsq2nGiC3BYL2ZxzVUOzZgQiygjtbNMRuoilFCHMsu4JViLhW_b2Eav3w8V2ZZcu21PvKALzSS0y3g_XFyVu4O1CgQPzxvbzxvTjiWQChU7zdk1eZcTJ-Gy_7g_H7cqPrhy3EG-vhgbqxS_hn_Im1gqR9ln1zuTV_OwPJyZMxvM52_TBmOIGt7aOfKR6kZlzUefbLYCEPcCfqggoX69WUIGQXG1wliaai2bRRfESDcc8OFO03xxOInxQBj6RCA1v-YcN8tO9TDejsSWh6EKk4AUG77iD4A5eNtmcMP-F3vWcwlXYFs3tVtPrCyz3psvmCCFN1KM7Vbgjm9P4in_Yx_hpqm-Ttlluql7bkTjYXt1VT7UUQnGrS6n97de47uXgnXIjrw5WMsLhQq3wOLLjoilBk7GDjao9j2UxtbhI\", \"scope\": \"openid email offline_access\"}" "http://192.168.1.11/post"

& replaced URL with "https://auth.tesla.com/oauth2/v3/token"

@TeslaOwnerTips
Copy link
Author

TeslaOwnerTips commented Dec 25, 2021

I did see #431 but that was with regards to auth token and the recaptcha at that stage.

/oauth2/v3/authorize

@GaPhi
Copy link
Contributor

GaPhi commented Dec 25, 2021 via email

@BlackPhoenix
Copy link
Contributor

What? No, just create a brand new token, using the same credentials. Each set of token/refresh token will live independently.

@TeslaOwnerTips
Copy link
Author

Would it not be a security risk if mutliple refresh token were allowed to exist? I guess changing the account password would solve that.

@TeslaOwnerTips
Copy link
Author

I generated a new SSO Refresh Token using my wife's account. Same error.
I'm using TeslaFi's Chrome plugin to get the sso token.

@NikhithVasa
Copy link

Can I hit any of the apis listed here https://tesla-api.timdorr.com/miscellaneous/endpoints with the refresh_token and the access_token from the app - https://apps.apple.com/us/app/auth-app-for-tesla/id1552058613? if Yes can someone PLEASE provide me the curl command as the above website doesn't explain what the request params/ how to pass the auth token while hitting the vehicle apis. Any help is really appreciated. Thanks in advance.

@TeslaOwnerTips
Copy link
Author

TeslaOwnerTips commented Dec 28, 2021

@nickjava create a separate issue. Never hijack a thread on github. Don’t add to it by responding. Just do it and don’t add anything irrelevant to this thread even if it is an apology.

@simwood-simon
Copy link

Same issue here accessing per the docs:

curl -X POST  -A "Powerwall" -H 'Content-Type: application/json' -d '{"grant_type": "refresh_token", "client_id": "ownerapi", "scope": "openid email offline_access", "refresh_token": "my_refresh_token_removed"}' https://auth.tesla.com/oauth2/v3/token

<HTML><HEAD>
<TITLE>Access Denied</TITLE>
</HEAD><BODY>
<H1>Access Denied</H1>

You don't have permission to access "http&#58;&#47;&#47;auth&#46;tesla&#46;com&#47;oauth2&#47;v3&#47;token" on this server.<P>
Reference&#32;&#35;18&#46;97997a5c&#46;1648392267&#46;175f1465
</BODY>
</HTML>

@faekz0r
Copy link

faekz0r commented May 11, 2022

Same issue here accessing per the docs:

curl -X POST  -A "Powerwall" -H 'Content-Type: application/json' -d '{"grant_type": "refresh_token", "client_id": "ownerapi", "scope": "openid email offline_access", "refresh_token": "my_refresh_token_removed"}' https://auth.tesla.com/oauth2/v3/token

<HTML><HEAD>
<TITLE>Access Denied</TITLE>
</HEAD><BODY>
<H1>Access Denied</H1>

You don't have permission to access "http&#58;&#47;&#47;auth&#46;tesla&#46;com&#47;oauth2&#47;v3&#47;token" on this server.<P>
Reference&#32;&#35;18&#46;97997a5c&#46;1648392267&#46;175f1465
</BODY>
</HTML>

Did you find a solution? Running into the same issue here.

@TeslaOwnerTips
Copy link
Author

No :(
Using the Tesla Fi api for now. Moved on to other hobbies 😊

@timdorr timdorr closed this as completed May 21, 2022
@simwood-simon
Copy link

simwood-simon commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants