Search code examples
authenticationauth0auth0-connection

Auth0 - how to create a user without a password, or how to include password in verification email


We have a web app (SPA Angular app talking to a .Net Core Web API) which uses Auth0 as the authentication server.

Now, I'm not sure if this would be an "invite flow" or "invite-only flow", or something else, but basically, a user will go to our web app, and create an account on our system. Our API then creates an Auth0 account for this user using the Auth0 Management API. This user is then considered the Administrator. She can then create as many users as she wants for her staff. For each user she creates, our API creates an Auth0 user using the Management API.

Since, as far as I'm aware, a user must be assigned a password at the moment of creation (i.e. you cannot create a user without a password), the administrator must pick a password for each user she creates.

Additionally, each time a user is created, Auth0 automatically sends out an email to that user asking them to verify their email address. When the user follows this link, it takes them to the Auth0 login screen where they have to fill in their email address and password.

My problem is that, unless the administrator tells them what password she picked for them, there's no way of them knowing.

My question is: is there a way to defer picking a password until the user logs in for the first time? So, when the administrator creates the user, she doesn't pick a password. Then, upon the user's first login, they pick their own password.

Alternatively, if a password MUST be set at the moment of creating the user, could this password be displayed to the user in the email verification email? I would essentially treat this as a temporary password, as I would also require the user to change their password upon first logon in this case.,

Thanks


Solution

  • You can create users without a password when carrying out a bulk import into a database connection; they would then need to go through the password reset flow before they could login.

    Please see the documentation here on how you could implement an invite flow using our current feature set: Auth0 Docs

    Using the above, you repurpose the reset password flow as "choose your new account password," and you can customise the Password Reset page so the text makes more sense in this context for your end-users.