User Invitation flow - Need clarity

Hi,
we are evaluating Auth0 user invitation flow for user signup. We have couple of questions that were not clear.
Here is the flow we wanted to implement using User invitation

  1. As a first step capture email along with country/region code
  2. Send verification link, and user clicks on the link to verify email.
  3. Show the password screen and user adds new passoword.
  4. When user login with the username and passoword, the country code should be sent as part of the access token.

To achieve this using auth0, tried the following steps
1.Disabled Welcome and verification email templates.
2. Created a hook for post user registration as mentioned in Sending Email Invitations For Application Signup
3.created a user using the api/v2/users endpoint. User is created.
But did not receive any email when user is created. What is missing here?

Questions:

  1. Is the endpoint api/v2/users protected as it requires a bearer token or available to be accessed by any mobile clients?
  2. Why is invitation mail not sent as mentioned in the above steps?

Detailed steps to achieve this flow is highly appreciated.
Thanks

Hi @vidyarani.nethi

Actions are recommended over using rules + hooks. I tried above mentioned flow using Actions and I am getting password change email.

Steps that I followed:

  1. Create custom Post User Registration action, here I have called it user-invitation
  2. Add below code to custom action
var AuthenticationClient = require('auth0').AuthenticationClient;

/**
* Handler that will be called during the execution of a PostUserRegistration flow.
*
* @param {Event} event - Details about the context and user that has registered.
*/
exports.onExecutePostUserRegistration = async (event) => {
  var authClient = new AuthenticationClient({
    domain: 'YOUR_DOMAIN',
    clientId: 'YOUR_CLIENT_ID',
  });

  var userAndConnection = {
    email: event.user.email,
    connection: 'Username-Password-Authentication',
    connection_id: event.connection.id,
  };

  authClient.requestChangePasswordEmail(userAndConnection, function(err){
    console.error(err)
  });
};
  1. Drag and drop this newly created action between Start and Complete as shown below

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.