Hub should automatically fire tokenRefresh
event through Hub
#13440
Labels
Auth
Related to Auth components/category
feature-request
Request a new feature
Hub
Related to Hub category
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 atokenRefresh
event with anauth
listener. This appears to be partially true. Token refreshes do not happen automatically (via asetTimeout
, for example), so a Hub event is not sent automatically. A token refresh will only happen when the application manually callsfetchAuthSession
. When that manual fetch happens, atokenRefresh
event is pushed through theHub
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?
The text was updated successfully, but these errors were encountered: