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:
- Watch for an authentication error and then request a new
access_token
. - 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!