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

Hub should automatically fire tokenRefresh event through Hub #13440

Open
2 tasks
amoffat opened this issue May 28, 2024 · 1 comment
Open
2 tasks

Hub should automatically fire tokenRefresh event through Hub #13440

amoffat opened this issue May 28, 2024 · 1 comment
Labels
Auth Related to Auth components/category feature-request Request a new feature Hub Related to Hub category

Comments

@amoffat
Copy link

amoffat commented May 28, 2024

Is this related to a new or existing framework?

Angular, React, React Native, Vue, Web Components, Next.js, New framework

Is this related to a new or existing API?

Authentication

Is this related to another service?

No response

Describe the feature you'd like to request

These docs suggest that Hub is useful for listening for a tokenRefresh event with an auth listener. This appears to be partially true. Token refreshes do not happen automatically (via a setTimeout, for example), so a Hub event is not sent automatically. A token refresh will only happen when the application manually calls fetchAuthSession. When that manual fetch happens, a tokenRefresh event is pushed through the Hub auth listener. This feels very unintuitive.

The feature request is that token refreshes happen automatically, by examining the fetched JWT for the expiration time, and setting a timeout that automatically refreshes the token after the time has elapsed. This way, it will be intuitive to set up a Hub listener that responds to tokenRefresh events.

Describe the solution you'd like

See above

Describe alternatives you've considered

An alternative would be to track and trigger token refreshes application-side (as opposed to framework-side). This feels wrong.

Additional context

No response

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change
@amoffat amoffat added the pending-triage Issue is pending triage label May 28, 2024
@cwomack cwomack added feature-request Request a new feature Auth Related to Auth components/category Hub Related to Hub category and removed pending-triage Issue is pending triage labels May 28, 2024
@cwomack
Copy link
Member

cwomack commented May 28, 2024

Hey, @amoffat and thanks for opening this feature request based on the discussion of the related #13436. We'll review this internally and reach out with any further questions or context we need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auth Related to Auth components/category feature-request Request a new feature Hub Related to Hub category
Projects
None yet
Development

No branches or pull requests

2 participants