How can I figure out the frequency that my personal access token will expire?

I received the following error which broke my one off application:
“errors”: [
{
“message”: “Personal access token has expired. Your token can be reset in the Developer App Console: Log in - Asana”,
“help”: “For more information on API status codes and how to handle them, read the docs on errors: Build an app with Asana
}
]
How can I automate rotation of my personal access token? If that is not possible, can I at least receive notification that my token is about to expire? My application runs on a schedule so I only discover the error on failure.

2 Likes

Tokens lasts for around 1 hour. You should detect the expired token response, and code something to refresh it and retry our previous call.

That’s true for OAuth tokens but not for PATs, @Frederic_Malenfant, right? I didn’t think they expired at all. Apparently they do but it must be a long time, maybe a year or more?

@AndrewWong can you say how long a PAT is good for?

1 Like

Oh I didn’t know they exists ! We always use oauth in our app! I don’t find any documentation about the duration of the PAT.