mardi 3 février 2015

Determining When to Refresh Access to Asana API


Vote count:

0




When I do the initial authentication to the Asana API with OAuth, it gives me a refresh_token as well as an expires_in of 3600 ms (1 hour).


What is the typical way of determining whether my app will need to use the refresh_token to get a new access_token?


I can think of two options:



  1. Watch for an authentication error and then request a new access_token.

  2. Store the date/time from now until 1 hour from now. Then with each API request, check the date/time to see if that time has already passed, and if so, request a new access_token.


Is there a better way than one of these two options? I don't see a recommendation from Asana in their OAuth documentation.


Thanks!



asked 53 secs ago







Determining When to Refresh Access to Asana API

Aucun commentaire:

Enregistrer un commentaire