Extending the expiration time for a token

Hello,

I am working on an Atlassian Connect app, but I noticed that after some minutes the session expires and I get the following error on the page:
Unauthorized: Authentication request has expired. Try reloading the page.

Looking in the documentation I found out the Token has an expiration of 15 minutes, see the Token expiration section from the following page:

https://developer.atlassian.com/cloud/jira/platform/user-impersonation-for-connect-apps/

It mentions that: “Rather than handling a token expiration error, track the expiration time and request a new token before it expires”

How can I request a new token?

On the following page:
https://developer.atlassian.com/cloud/jira/platform/cacheable-app-iframes-for-connect-apps/?_ga=2.42394213.1108715265.1718026200-251512707.1708263804#retrieving-context-using-ap-context-gettoken--

On the Token validity period section, it is mentioned the use of the AP.context.getToken() function to refresh tokens. However, my module is of the “Search Request View” type and this type of modules doesn’t work with the Connect Javascript API(known as AP). AP only works in a Connect iFrame, but this module is not in such a context.

Then, How can I request a new token? in a “Search Request View” module type?

Thanks,
Edgar