Hello,
I have some problem refreshing the access_token when it is expired.
In my script I use "Client credentials grant type", I can get the access_token and the refresh_token and for 3 hours I can get the temperature readings, then the access token expires and I try to refresh it (If I refresh it before it expires, it seems does not work), but following reads return:
{"error":{"code":2,"message":"Invalid access_token"}}
What is the correct way to proceed for refreshing?
Thanks in advance
Kind regards
Dario
Invalid access_token
-
- Posts: 11
- Joined: 02 Apr 2022, 16:50
Re: Invalid access_token
Hello,
to provide a little more detail:
after the initial three hours (corresponding to the default 10800 seconds) the following call:
headers = {
'Authorization': 'Bearer ' + access_token,
}
response = requests.request(\
'GET', \
netatmo_api_url + '/homestatus?home_id=' + home_id, \
data = '', \
headers = headers, \
)
returned
{"status":"ok","time_server":1655542717,"body":{"home":{"id":"RemovedForPrivacy"},"errors":[{"code":6,"id":"RemovedForPrivacy"}]}}
Any suggestion will be very welcome and appreciated
Thanks in advance
Dario
to provide a little more detail:
after the initial three hours (corresponding to the default 10800 seconds) the following call:
headers = {
'Authorization': 'Bearer ' + access_token,
}
response = requests.request(\
'GET', \
netatmo_api_url + '/homestatus?home_id=' + home_id, \
data = '', \
headers = headers, \
)
returned
{"status":"ok","time_server":1655542717,"body":{"home":{"id":"RemovedForPrivacy"},"errors":[{"code":6,"id":"RemovedForPrivacy"}]}}
Any suggestion will be very welcome and appreciated
Thanks in advance
Dario
Re: Invalid access_token
Hello Dario,
I saw your message via the contact form, I answered you there
Have a good day,
Leslie - Community Manager
I saw your message via the contact form, I answered you there
Have a good day,
Leslie - Community Manager
-
- Posts: 11
- Joined: 02 Apr 2022, 16:50
Re: Invalid access_token
Hi Leslie,
after a deep verification I have to admit that you were right and I was wrong!
Because of an error of logic the newly refreshed access_token was not used (as I thought), so causing the error.
Thanks for your kind support!
Best regards
Dario
after a deep verification I have to admit that you were right and I was wrong!
Because of an error of logic the newly refreshed access_token was not used (as I thought), so causing the error.
Thanks for your kind support!
Best regards
Dario