Aashima Gupta
Aashima Gupta

Reputation: 13

Invoke Rest API on email verification ADB2C custom policy

The default functionality of ADB2C for email verification verifies the verification code sent to the corresponding email. However it does not check whether that email is already registered or not. Until now we have been doing this by calling a Rest API on clicking create. But now it is required to check if that email is already registered or not at the email verification step. Is there a way to call a Rest API at email verification step? If yes, then how can it be done?

Upvotes: 1

Views: 294

Answers (1)

Phil Whipps
Phil Whipps

Reputation: 208

You could separate the input of email address and user data to a different page, and then just do the email verification on a next page. That way you can check if the user exists on the previous page and verify the email on the next.

You also do not need to call out to a REST endpoint to check if they exist. You can use a technical profile that inherits the AAD-Common Technical profile to see if they exist.

<TechnicalProfile Id="DoesUserExist">
      <Metadata>
        <Item Key="Operation">Read</Item>
        <Item Key="RaiseErrorIfClaimsPrincipalDoesNotExist">false</Item>
      </Metadata>
      <InputClaims>
        <InputClaim ClaimTypeReferenceId="email" Required="true" PartnerClaimType="signInNames" />
      </InputClaims>
      <OutputClaims>
        <OutputClaim ClaimTypeReferenceId="UserSearchOID" PartnerClaimType="objectId" />
      </OutputClaims>
      <IncludeTechnicalProfile ReferenceId="AAD-Common" />
</TechnicalProfile>

Upvotes: 1

Related Questions