I am learning Actions and am interested in the pre-user-registration trigger functionality. My end goal is to take action prior to an account getting created in Auth0.
Does this trigger fire when someone tries to login with a oAuth provider for the first time and BEFORE that user identity is saved as a user?
I am not grokking the documentation on what actions and when the trigger occurs.
Here is the full list of triggers and flows for actions. I don’t think there is one that meets your criteria. Maybe @rueben.tiow can weigh in, whether this is possible or if a feature request is needed.
Yeah I don’t understand how adding a new user identity (creating) when someone is LOGING IN in is a feature and not a bug. I seem to be the minority on this though.
Well in the case that you are using a third party Identity Provider, Auth0 is not creating the user identity on login. They are creating a user profile in Auth0. The identity lives with the third party (social or enterprise connections).
You can probably have an action that checks if this is a new profile on their first login.
I would imagine in a post-login action you could check if event.stats.logins_count is 1 (or 0, i’m not sure when it increments).
Yes, this would be a great workaround! For clarity, the login count will be 1 because Enterprise or Social users gets added to Auth0 regardless of clicking the “signing up” and “logging in” buttons. Meaning, that the user will always log in both sign-up and log-in flows.
exports.onExecutePostLogin = async (event, api) => {
if (event.stats.logins_count === 1) {
//Your logic here
}
};
I hope this helps!
Please let me know if you have any additional questions.