Check Mail

Azure ADVERTISEMENT B2C: Custom-made e-mail proof code

This example remedy shows exactly how to utilize customized email verification. The personalized e-mail proof answer permits you to send your personal customized email proof during the course of sign-up or even code reset customer journey. The answer needed using Azure ADD B2C custom-made plan and a REMAINDER API endpoint that sends the e-mail confirmation as well as validates the verification regulation.

essay review

The essential principle of custom e-mail proof: During the course of sign-up or even code reset and improvement email custom plans, a consumer delivers the sign-in email handle. Customer selects carry on, Azure ADVERTISEMENT B2C contacts a REST API endpoint that creates a verification regulation. The proof regulation is actually delivered to the consumer’s email as well as return back to Glowing blue ADD B2C. On the following page (sign-up, password reset and also modification e-mail) customer is requested to offer the proof code (sent out by e-mail) alongside the rest of the info, like sign-up user profile, security password totally reset the new password. When customers click the continue button, Glowing blue ADVERTISEMENT B2C makes one more contact us to the REST API, sending both the verification code produced in the previous measure as well as the proof code offered due to the end user. The REMAINDER API contrasts the confirmations codes and also lets the customer improve, or even generate the profile

Consumer flow

Personalized e-mail verification regulation deals with following circumstances:


  1. LocalAccountSignUpWithLogonEmail-FirstStep self-asserted technical account
    1. Turns off the default Azure ADVERTISEMENT B2C e-mail proof, utilizing the EnforceEmailVerification metadata
    2. Accumulates the e-mail handle
    3. Copies the email handle to the CopyEmailAsReadOnly case type
    4. Telephone calls the REST-API-SendVerificationEmail verification specialized profile that creates the confirmation code, sends the e-mail
    5. Returns the proof code as outcome insurance claim
  2. On the next orchestration measure, B2C calls the LocalAccountSignUpWithLogonEmail-SecondPage technological profile page. This Personal claimed sign-up webpage. It is actually based upon the LocalAccountSignUpWithLogonEmail, while removing the e-mail case as well as changing the validation specialized profile pages
    1. Shows the e-mail in read through simply mode
    2. Asks the user to give the proof code (delivered through email), the passwords, and also consumer profile
    3. When individual clicks proceed, B2C operates the REST-API-verifyCode recognition technological account that reviews the proof code provided by the consumer as well as the one produced by the REST API in the previous step.
    4. The second recognition specialized profile page AAD-UserWriteUsingLogonEmail makes the account

Password reset

  1. LocalAccountDiscoveryUsingEmailAddress self-asserted specialized profile page
    1. Turns off the nonpayment Glowing blue AD B2C e-mail proof, using the EnforceEmailVerification metadata
    2. Gathers the e-mail deal with
    3. Phone calls the REST-API-SendVerificationEmail verification technological profile that produces the verification code, as well as delivers the e-mail
    4. Come backs the confirmation code as result claim
  2. On the following musical arrangement action B2C contacts the LocalAccountWritePasswordUsingObjectId-SecondStep technical profile page. This Self insisted security password recast webpage. It is actually based upon the LocalAccountWritePasswordUsingObjectId, while incorporating the proof code functionality
    1. Talks to the consumer to deliver the proof code (sent by e-mail) and also the new code
    2. When user clicks on continue, B2C functions the REST-API-verifyCode recognition technological profile that compares the verification code provided by the individual and also the one created due to the REMAINDER API in the previous step.
    3. The second verification technological profile AAD-UserWriteUsingLogonEmail generates the profile

Improvement sign-in email deal with

  1. Talk to the user to sign-in with the neighborhood account e-mail address
  2. Go through the consumer profile page from Azure ADD
  3. LocalAccountEmailVerification-FirstStep self-asserted specialized profile page
    1. Disables the nonpayment Azure ADD B2C e-mail confirmation, making use of the EnforceEmailVerification metadata
    2. Picks up the email deal with
    3. Telephone calls the REST-API-SendVerificationEmail validation technological profile that generates the confirmation code, and delivers the e-mail
    4. Returns the verification code as result case
  4. On the upcoming musical arrangement measure B2C contacts the SelfAsserted-EmailVerification self-asserted specialized profile page
    1. Asks the individual to provide the proof code (delivered through e-mail)
    2. When consumer clicks continue, B2C runs the REST-API-verifyCode validation technological profile that contrasts the proof code supplied due to the user as well as the one produced by the REST API in the previous measure.
    3. The 2nd recognition specialized profile AAD-UserWriteEmailUsingObjectId store the brand-new e-mail handle to the account

Operate the remedy

To operate the graphic studio remedy, you need to have:

  1. Deploy this internet app to Azure App Services. For more information, view Generate and also post the internet app
  2. Set the app environments. You can set the app environments directly coming from appsettings.jsonn data. Or even use the much better answer, from Azure portal. For more information, view: Set up internet apps in Azure Application Company

Significant details:

Safeguard the interaction in between Azure AD B2C to your Relax API. To learn more, see: Get your Peaceful service by using customer certifications OR Get your Peaceful services by utilizing HTTP fundamental authentication

Answer artifacts

This sample plan is based on LocalAccounts starter pack.

  • All improvements are actually noted with Trial: comment inside the policy XML data.
  • Make the important changes in the Activity needed comments

Aesthetic workshop remedy

  • IdentityController The personalized policy names this REMAINDER API
  • appsettings.json function settings
  • Styles folder – this folder has the required object-mapping courses

To assess the sample solution, open up the AADB2C.Invite.sln Visual Workshop service in Visual Workshop. In the AADB2C.Invite project, open the appsettings.json. Change the application environments along with your very own market values:

  • SMTPServer: Your SMTP server
  • SMTPPort: Your SMTP web server port number
  • SMTPUsername: SMTP user label, if necessary
  • SMTPPassword: SMTP security password, if needed
  • SMTPUseSSL: SMTP usage SSL, accurate of misleading
  • SMTPFromAddress: Send out from e-mail deal with

Utilize this solution for sign-in with username

If your policy is actually username based, produce the nassacery improvements:

  • Sing-Up – Create your retail store the email address to the strongAuthenticationEmailAddress as opposed to the signInNames.emailAddress
  • Password reset – After the validation, you should search for the profile utilizing the username (instead of the e-mail address), and also contrast the rebound strongAuthenticationEmailAddress to the one provided and validated by the customer.
  • Chage email deal with – When you review and also compose, make use of the strongAuthenticationEmailAddress as opposed to the signInNames.emailAddress


The example is actually cultivated as well as managed due to the open-source area in GitHub. The application is actually not portion of Azure ADD B2C product and it is actually certainly not assisted under any Microsoft standard support system or even service. The sample (Azure AD B2C policy as well as any type of companion code) is actually given AS LACKS guarantee of any kind.

Note: This example policy is based on logon with username policy. All adjustments are actually marked along with Trial: comment inside the policy XML files. Make the nessacery changes in the Trial activity called for sections.