Implementing user invitations for application sign-up on Auth0
On Auth0, you can implement user invitations using the password change workflow.- By styling the Universal Login or Classic Login password reset page to additionally support a user invitation experience, you can use a password change link as an invitation to a new user account.
- By similarly customizing the password change email template, you can use Auth0’s password change workflow to generate the password change link and send the invitation email using your tenant’s configured SMTP provider.
If you already have an external email solution and don’t want to configure an SMTP provider on your tenant, you can use the Management API to generate the password change ticket and email the ticket link to the user yourself instead of using Auth0’s email template and workflow.
user.app_metadata.needsInvitation in these instructions) which indicates that the user has an outstanding invitation: when it’s true, the user receives the user invitation experience; otherwise, they receive the regular password reset experience.
1. Customize the password change email template
First, customize the password change (link) email template to handle both user invitation and password change workflows. Use Liquid to check whether the user metadata property for an outstanding invitation is set and send the appropriate message. For example:type=invite or type=reset.
2. Style the password reset page
Based on the query parameter you set in the template, style the password reset page to support both user invitation and password change workflows based on the query parameter. For instructions with Universal Login, read Customize Universal Login. For instructions with Classic Login, read Customize Password Reset Page.3. Create a post-login Action to unset the invitation property
Once the user sets their password and logs in for the first time, they no longer need an invitation and should receive the password change experience in the future. To handle this, create a post-login Action that setsuser.app_metadata.needsInvitation to false:
4. Send user invitations
To send a user invitation, create a new Auth0 database user from the dashboard or the Create a User endpoint in the Management API and:-
Set the
user.email_verifiedparameter set tofalse. -
Set
user.app_metadata.needsInvitationtotrue.
Learn more
To control where the user is redirected after setting their password:- For Universal Login, customize the password reset flow login route.
- For Classic Login, set the Redirect To field in the email template.