What would be best practice around re-issuing user’s access token?

My web app automatically checks for the new modification or new issues with the jira after certain interval(each 25 minutes).

Now, Access token gets expired within an hour.

So What would be best practice around re-issuing user’s access token?

  • Should I continuously make call to get the access token using a cron job? Or

  • I get new access token right before checking for each modifications ?

Thank you.

Hi @brikme

in the atlassian-connect-express library, Atlassian …

  • caches access tokens together with their expiry time (which you can get from the JWT or the HTTP headers I think)
  • Upon sending a request, they check if the previous access token expired.
    • If it did, then they fetch a new one and put it in the cache,
    • otherwise they use the old token for the request.

See Bitbucket .

I remember the Stride Node.js Client Library did the same. I would infer from that, that this is the way to go.

Hope this helps!
Cheers,
Tobi

1 Like

Hi @tobitheo.

Thank you. that’s really what I was looking for.

Have a good day.