Send email after creating user using Graph API in B2C

Anu Garg 37 Reputation points
2021-11-30T12:12:42.687+00:00

Hi Team,

We have below requirement:

  1. We are creating B2C users (with random password) using Graph API from our Asp.Net Core Web API.
  2. We want to send welcome email to the user along with some link so that user can directly launch the "Password Reset" page and then can login to his application after setting the password.

As per my research, Different Solutions and their cons:

  1. User login and follow the forgot password journey from login but that's bit annoying for new users. How would they know that they have to follow forgot password journey on 1st login.
  2. Implement "Forced to reset password on 1st Login" policy - but for this policy, user should know his initial password.
  3. Using REST API - we can't use REST api in custom policy as we are creating user using Graph API.

Is there any better way to send email to user on creation(using graph API)?

Any help is much appreciated.

Thanks in advance,
Anu

Microsoft Entra External ID
Microsoft Entra External ID
A modern identity solution for securing access to customer, citizen and partner-facing apps and services. It is the converged platform of Azure AD External Identities B2B and B2C. Replaces Azure Active Directory External Identities.
2,844 questions
{count} vote

2 answers

Sort by: Most helpful
  1. Anu Garg 37 Reputation points
    2022-09-06T15:15:15.83+00:00

    Hi @Nukasani, Venkata Praveen @ Hyderabad & @Jorge Rodriguez Galan ,

    We used our own webapi to send email with the password reset link.
    Steps are as below:

    1. Create user in B2C from our webapi using MS Graph
    2. If successful then send an email to user to set the password with link "Set Password"
    3. The url of that "Set Password" link is to one of our webapi endpoint
    4. In "Set Password" webapi endpoint, we are calling B2C challenge with B2c ForgotPassword policy.
    5. User can set his/her password and login to application.

    Hopefully answered your query. Please let me know if I can help you more.

    Regards,
    Anu

    1 person found this answer helpful.
    0 comments No comments

  2. James Hamil 24,311 Reputation points Microsoft Employee
    2021-12-04T00:32:34.107+00:00

    Hi Anu, are you creating these users off of a list you have, as opposed to making a sign up flow for them? For your options, having a password reset on the first login seems to be the easiest. You could also enable Self Service Password Reset so they can reset whenever they want. You can then send them an email reminding them to change their password. Does any of this sound like a good fit for you? Please let me know if you have any questions.

    If this answer helped you please mark it as "Verified" so other users may reference it.

    Thank you,
    James


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.