Auth0 Home Blog Docs

Using Lock signup with loginAfterSignUp: false

Hello,

I am using lock for sign in and sign up. My sign up process is a stepped process. First two steps gather information about the user/business and the last step is lock to sign up. I have a timing problem, which i hope will be resolved with https://github.com/auth0/lock/issues/1748. Until then, i need to use loginAfterSignUp: false so that i can gate the user from signing in until the user_metadata has all the info. How can i tell if the signup was a success?

Hi @bstaley0,

For the time being, the simplest way to implement this functionality would probably be to gate access using a rule. Rules run immediately after a user authenticates (which means they will run when the user signs up if loginAfterSignup is true and will not if it is false) and can used to grant or restrict access to your application. Please see our rule for requiring email verification for an example of this.

Instead of checking user.email_verified, you would want to create a rule which checks whether the metadata you require is present. This could be done by either checking each individual attribute and/or by adding a single metadata field to act as a flag which indicates whether the user/busieness’ profile is “complete” according to your specifications. You may find our documentation on using metadata in rules related best practices to be helpful.