Well, my situation is as follows. I am trying to implement auth0 authentication plus an in-app form of my own with data that auth0 does not provide. However, I need to be able to differentiate between a SignIn and a SignUp in order to be able to route the user to the corresponding screen. At the moment I haven’t found any way to do it…
Hello @homerogazze1015 welcome to the community!
One option is to use an action to add a custom claim to a user’s ID token indicating that it is their first time logging in, and thus have just signed up. After adding the custom claim to a user’s ID token, you can access the claim in the useAuth0() hook.
Action code to add the custom claim for example:
exports.onExecutePostLogin = async (event, api) => {
const namespace = 'https://yournamespace.com/'; // replace with your namespace
let isNewUser = event.stats.logins_count === 1;
api.idToken.setCustomClaim(namespace + 'isNewUser', isNewUser);
}
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.