Appearance
Documentation / react-auth / useSubscribeToJwtAuthWithFlag
Function: useSubscribeToJwtAuthWithFlag() ​
useSubscribeToJwtAuthWithFlag(
__namedParameters
):UseSyncJwtBasedAuthStateInterface
This is a utility hook for subscribing to an external JWT-based authentication system that offers a "flag" or hook based API, with values like isAuthenticated
, instead of direct listeners on auth state changes
Parameters ​
• __namedParameters: UseSubscribeToJwtAuthWithFlagInput
Returns ​
UseSyncJwtBasedAuthStateInterface
An object containing the current state of the JWT authentication flow.
See ​
useSyncJwtBasedAuthState for more information on syncing JWT authentication state.
Example ​
ts
const {isAuthenticated, getAccessToken} = useSomeAuthSystem();
const {subscribe} = useSubscribeToJwtAuthWithFlag({
isAuthenticated,
getExternalJwt: getAccessToken,
});