I´m currently making my own twitch Bot with a !setgame and a !settitle command.
Everything is working fine, i send a request to the api with a user access_token generated with the OAuth authorization code flow method.
Some hours later the commands don’t work anymore because the token expires. Thanks to the refresh_token i can generate a new one and everything is working again.
I have some questions anyway…
• I saw on the forum that my access_token can last about 4 hours. But is there a way to avoid sending an api request every 4 hours ? I need the token to be valid everytime the command is called.
Is there a good way to do that i’m missing ?
• When i send my api request to generate a new access_token, it returns an object with the “expires_in” field.
I thought the number value was the time in second until the token expires. But for example in my last request, the number returned was 14353 which is ~239 hours instead of the 4 hours. Why the value is not matching and is there a way to know exactly what this value means ?
Oh… I feel so stupid
My brain was too focused on the API documentation that I read for hours to be sure I understood everything.
Guess i have some maths lessons to take…