I’ve added a custom claim property with Auth0 Actions, called logins_count
to determine if a user has just signed up or not.
Based on that, we want to redirect to different pages (welcome screen), or possibly other logic.
This is currently handled in onRedirectCallback
. This callback gives us (appState, user)
. But the user object doesn’t contain the claim data.
So you might say to use getIdTokenClaims()
, but I can’t use that in the callback, because I have to do
const { getIdTokenClaims } = useAuth0()
<Auth0Provider
...
onRedirectCallback={async (appState, user) => {
const ... = await getIdTokenClaims()
}}
/>
which isn’t possible because the getIdTokenClaims
is from the hook which is outside the provider.
I can potentially use the hook from a child, but there I don’t have access to appState
from the callback.
So what am I supposed to do here? (Seems the callback is a port from a node project, and not quite used in the “react way”)