Hi @DK , the issue you're encountering is likely due to the way Azure AD B2C handles the EnforceEmailVerification
and the pre-filled email from the login_hint
. When the email is pre-filled, the system might be considering it as already verified, hence the verification button disappears.
You need to make sure that the email is verified even if it is pre-filled. One way to handle this is by using a claim transformation to ensure the email verification step is properly enforced.
Here are the steps to modify your policy:
- Update the
EmailVerification
Technical Profile:- Add a claim transformation to ensure the email is always treated as unverified initially.
- Check the
EnforceEmailVerification
metadata item is set properly.
<ClaimsProvider>
<DisplayName>Email Verification</DisplayName>
<TechnicalProfiles>
<!-- Email verification only -->
<TechnicalProfile Id="EmailVerification">
<DisplayName>Initiate Email Address Verification For Local Account</DisplayName>
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.SelfAssertedAttributeProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<Metadata>
<Item Key="ContentDefinitionReferenceId">api.localaccount.emailVerification</Item>
<Item Key="IncludeClaimResolvingInClaimsHandling">true</Item>
<Item Key="EnforceEmailVerification">True</Item>
<Item Key="language.button_continue">Continue</Item>
</Metadata>
<InputClaims>
<InputClaim ClaimTypeReferenceId="email" DefaultValue="{OIDC:LoginHint}" AlwaysUseDefaultValue="true" />
</InputClaims>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="email" PartnerClaimType="Verified.Email" Required="true" />
<OutputClaim ClaimTypeReferenceId="isEmailVerified" DefaultValue="false" />
</OutputClaims>
<OutputClaimsTransformations>
<OutputClaimsTransformation ReferenceId="MarkEmailAsUnverified" />
</OutputClaimsTransformations>
</TechnicalProfile>
</TechnicalProfiles>
</ClaimsProvider>
- Define the
MarkEmailAsUnverified
Claims Transformation:- This transformation will ensure the
isEmailVerified
claim is set tofalse
initially.
- This transformation will ensure the
<ClaimsTransformations>
<ClaimsTransformation Id="MarkEmailAsUnverified" TransformationMethod="AssertBooleanClaimIsEqualToValue">
<InputClaims>
<InputClaim ClaimTypeReferenceId="isEmailVerified" TransformationClaimType="inputClaim" />
</InputClaims>
<InputParameters>
<InputParameter Id="valueToAssert" DataType="boolean" Value="false" />
</InputParameters>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="isEmailVerified" TransformationClaimType="outputClaim" />
</OutputClaims>
</ClaimsTransformation>
</ClaimsTransformations>
- Ensure
EnforceEmailVerification
is set toTrue
in theEmailVerification
Technical Profile. - Modify the User Journey:
- Verify that the email verification step is always executed and that the
isEmailVerified
claim is checked.
- Verify that the email verification step is always executed and that the
<UserJourney Id="SignUp">
<OrchestrationSteps>
<!-- Start with email verification -->
<OrchestrationStep Order="1" Type="ClaimsExchange">
<Preconditions>
<Precondition Type="ClaimEquals" ExecuteActionsIf="false">
<Value>isEmailVerified</Value>
<Value>True</Value>
<Action>SkipThisOrchestrationStep</Action>
</Precondition>
</Preconditions>
<ClaimsExchanges>
<ClaimsExchange Id="SignUpWithLogonEmailExchange_EmailVerification" TechnicalProfileReferenceId="EmailVerification" />
</ClaimsExchanges>
</OrchestrationStep>
<!-- Proceed to the sign-up page -->
<OrchestrationStep Order="2" Type="ClaimsExchange">
<ClaimsExchanges>
<ClaimsExchange Id="SignUpWithLogonEmailExchange_WithReadOnlyEmail" TechnicalProfileReferenceId="LocalAccountSignUpWithReadOnlyEmail" />
</ClaimsExchanges>
</OrchestrationStep>
<!-- Read the user after sign-up -->
<OrchestrationStep Order="3" Type="ClaimsExchange">
<ClaimsExchanges>
<ClaimsExchange Id="AADUserReadWithObjectId" TechnicalProfileReferenceId="AAD-UserReadUsingObjectId" />
</ClaimsExchanges>
</OrchestrationStep>
<!-- Issue the token -->
<OrchestrationStep Order="4" Type="SendClaims" CpimIssuerTechnicalProfileReferenceId="JwtIssuer" />
</OrchestrationSteps>
</UserJourney>
Please let me know if you have any questions and I can help you further.
If this answer helps you please mark "Accept Answer" so other users can reference it.
Thank you,
James