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

Allow manual refresh for access token #136

Closed
mattjennings opened this issue Jun 28, 2020 · 1 comment
Closed

Allow manual refresh for access token #136

mattjennings opened this issue Jun 28, 2020 · 1 comment

Comments

@mattjennings
Copy link

mattjennings commented Jun 28, 2020

Describe the problem you'd like to have solved

It would be helpful to let us force an access token refresh rather than waiting for them to expire. The scenario I've run into is updating a user's claims after they've updated their profile.

Describe the ideal solution

Adding a refresh option to the getAccessToken method, like so: tokenCache.getAccessToken({ refresh: true })

Alternatives and current work-arounds

This is my workaround, but it doesn't seem to always work.

const tokenCache = auth0.tokenCache(req, res)
const session = await auth0.getSession(req)

session.accessTokenExpiresAt = 1
await tokenCache.store.save(req, res, session)

// now it will refresh
const { accessToken } = await tokenCache.getAccessToken() 
@sandrinodimattia
Copy link
Member

This is now available in v0.16 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants