Skip to content
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

set-reserve ERROR gives Missing access token parameter. Auth token expired? #54

Open
ma773o opened this issue Nov 16, 2023 · 3 comments

Comments

@ma773o
Copy link

ma773o commented Nov 16, 2023

Hi,

python3 set-reserve.py --read
fails with this error:

ERROR: Failed to retrieve PRODUCT_LIST - (missing_token) Missing access token parameter.

I guess the problem is that the auth token has expired as I have the following in the set-reserve.auth file:
... "expires_in": 28800, "token_type": "Bearer", "expires_at": 1700028409.1826518}}}
which can be converted as expires_in 8 hours and expires_at Wednesday, November 15, 2023 6:06:49 AM GMT .

Is there a way to automatically refresh the token without having to login again?
Can it be embedded in set-reserve.py and the other tools?

Thanks

@mcbirse
Copy link
Collaborator

mcbirse commented Nov 16, 2023

Hi @ma773o - my understanding is that the TeslaPy module should actually automatically update the auth token file... I have used some very old saved auth token files before (however, with the tesla-history script from the Powerwall-Dashboard project) and never had an issue.

Have you checked the permissions of the set-reserve.auth file to ensure it is writable by the script perhaps?

@ma773o
Copy link
Author

ma773o commented Nov 16, 2023

Hi,
permissions are fine...
I've now tried to remove .auth and .conf file and re-do the login process to obtain a fresh token and it actually fails. I called it with -d to get debug info and I got the following (I've hidden personal data):

python3 set-reserve.py -d --login

Config file 'set-reserve.conf' not found

Do you want to create the config now? [Y/n] Y

Tesla Account Setup
-------------------
Email address: [email protected]
Save auth token to: [set-reserve.auth] 

Config saved to 'set-reserve.conf'

----------------------------------------
Tesla account: [email protected]
----------------------------------------
Open the below address in your browser to login.

https://auth.tesla.com/oauth2/v3/authorize?response_type=code&client_id=ownerapi&redirect_uri=https%3A%2F%2Fauth.tesla.com%2Fvoid%2Fcallback&scope=openid+email+offline_access&state=HIDDEN&code_challenge=HIDDEN&code_challenge_method=S256&login_hint=hidden%40hidden.com

After login, paste the URL of the 'Page Not Found' webpage below.

Enter URL after login: https://auth.tesla.com/void/callback?code=HIDDEN&state=HIDDEN&issuer=https%3A%2F%2Fauth.tesla.com%2Foauth2%2Fv3
ERROR: Login failure - (missing_token) Missing access token parameter.

This was working a couple of days ago, and of course my the email/password pair works when authenticating to tesla.com

@jasonacox
Copy link
Owner

Hi @ma773o - I'm not sure what could be going wrong here. You seem to be doing the right thing (I assume you removed replaced the real code with code=HIDDEN).

Some (likely not very helpful) thoughts:

  • Do you have more than one account with Tesla? Is this the right one?
  • Try to clear your browser cache / cookies and try again
  • Make sure you have the latest set-reserve.py

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

3 participants