oauth-2.0dailymotion-api

What's the purpose of setting expiry of client token if I can just refresh tokens everytime?


I'm using the Dailymotion API which uses Oauth2, their client tokens expire in 36000 seconds (10 hours), so I thought of creating new tokens for every call with the refresh token URL provided. Also, I didn't find any warnings in the documentation preventing me from doing this, is this a bad practice?


Solution

  • creating a new token on every requests is not the best way to proceed.

    During your request, you can check (ex: with a "try") if your access token has expired then request new one with your given refresh token only if necessary.

    If you are using a language like PHP, Python, Javascript, ... you can save much time using the available SDKs that already implement these mechanisms.

    cf. https://developer.dailymotion.com/tools/sdks/