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

Passport refresh token if stale #478

Open
fcaps opened this issue Nov 20, 2023 · 0 comments
Open

Passport refresh token if stale #478

fcaps opened this issue Nov 20, 2023 · 0 comments
Assignees
Labels

Comments

@fcaps
Copy link
Collaborator

fcaps commented Nov 20, 2023

The website session is longer than the token ttl from hydra, so you can be logged in while your token is outdated.
To combat this we need some automatic check if the token is stale and refresh it if possible.

For axios it could look like:

instance.interceptors.request.use(config => {
    if (token.expired()) {
      token = token.refresh()
    }

    config.headers['Authorization'] = `Bearer ${token.token.access_token}`;
    return config;
  });

open questions:

  • what if we cannot refresh? maybe throw an exception that can trigger client redirect to login?
  • how to make this globally available? maybe some global axiosClient?
  • how to implement this in tiny steps
@fcaps fcaps self-assigned this Nov 23, 2023
@fcaps fcaps mentioned this issue Dec 1, 2023
@fcaps fcaps added the Bug label Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant