Script can't Refresh Token more than 3 times

sspectro

Hello,

I've made some scripts that control the thermostat and valves depending on the external weather. Since this summer, i have to go on the dev website and generate tokens in myapp section (i was using the client credentials grant type before way more easiest). That's so annoying but, if my refresh script is correct, i'll have to do that only one time in order to get tokens the first time.

I put those tokens in my script and everything working fine. 3hours later, another script Refresh the access token and the refresh token, Everything working. 3hours later (+6h from the start), same thing. 3 more hours (+9h from the start) also.

And then, 3 more hours (+12hours from the start), my script can't refresh the tokens anymore. I've got a Code 400. I can't understand why the same refresh script is working 3 times and not after. In my script, in order to refresh tokens, it use the last access token and the last refresh token. 

Is something different 12hours later ? Did i miss something ?

 

And another question about the client credentials type: 

It's write in the dev documentation that it's

deprecated in october 2022 !!
If you want to access data from another user's account, you MUST use the Authorization code grant type.

But i want to access my data, with my app, with my account. Is it still working ? or not ? It's not clear.

I use the netatmo thermostat & valves since 2016, and i never had issues like that with the tokens.

Thanks a lot for your help.

0

Comments

2 comments

  • Comment author
    Leslie Community moderator

    Hello,

    Concerning the client_credentials grant type, it was totally deleted a few months ago. Unfortunately, it's not possible at all to use anymore the username/password "simple" way to authenticate. You have to use the authorization_code flow

    Concerning the refresh_token renewal process, we don't have any rule on our side to change its behaviour after a few refreshes. So it's pretty hard to know where is the problem. Are you sure that no other /token request is sent at a moment ? (for example : a connection to an other end-user device that would launch a /token request where new generated values are not caught and stored ?)

    Have a good day,

    Leslie - Community Manager

    0
  • Comment author
    sspectro

    Thanks for the clarification about the client_credentials. Unfortunately, there's no more easy way for us to get our data.

     

    Concerning my refresh problem, i'm agree with you. I must have something somewhere that try to ask new tokens and it's not store correctly. That's the most probable. So i will review all my code to find what's happen.

     

    Thanks.

     

    0

Please sign in to leave a comment.