Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle stale tokens when page is left for over 10 minutes #238

Open
keiranjprice101 opened this issue Jul 25, 2024 · 0 comments
Open

Handle stale tokens when page is left for over 10 minutes #238

keiranjprice101 opened this issue Jul 25, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@keiranjprice101
Copy link
Collaborator

Description of the issue

If a page is left idle for 10 minutes, the access token will expire. If you then attempt to use any of the tables the fia-api requests will fail with an expired token. A refresh event is not triggered because there is no navigation.

We need to create a scigateway event in this scenario.

There are 2 obvious options:

  1. Investigate if an interceptor can be attatched to all fetch requests to detect this behaviour and dispatch the refresh event before retrying the requests
  2. If interceptors are not supported by fetch add axios and replace all fetch calls with axios and define the axios interceptor

Inspiration can be taken from here: https://github.com/ral-facilities/inventory-management-system/blob/a8fc73bd43bc762473e9c558d6fcd894c338d539/src/api/api.tsx#L9

@Dagonite Dagonite added the enhancement New feature or request label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants