AZADB2C | Custom T&C in custom policy as a claim

Abhay Chandramouli 966 Reputation points
2022-04-21T04:35:57.81+00:00

Hi,
This is in continuation to https://learn.microsoft.com/en-us/answers/questions/815759/azure-ad-b2c-conditonal-registration-details.html.

So I have a login page by az b2c where I have added a custom t&c using customizable ui of azure ad b2c. Since this t&c is added via html, how can I pass it as claims ?

I am using custom policy : passwordless phone number scenario

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,639 questions
{count} votes

Accepted answer
  1. AmanpreetSingh-MSFT 56,306 Reputation points
    2022-04-21T08:39:35.697+00:00

    Hi anonymous user • Thank you for reaching out.

    Below are the steps to get the T&C as a claim in the token after the user signs up by accepting the Terms & Conditions in the passwordless phone number custom policy scenario.

    1. In the B2C_1A_Phone_Email_Base file, add the T&C claim under the <Claims Schema> section. In the below example, I have named my T&C claim as TnCs.
      <ClaimType Id="TnCs">  
       <DisplayName>Terms of Service Consent</DisplayName>  
       <DataType>string</DataType>  
       <UserHelpText>I agree to the Amansi Corp terms of service.</UserHelpText>  
       <UserInputType>CheckboxMultiSelect</UserInputType>  
       <Restriction>  
       <Enumeration Text="I agree to the terms of service." Value="4/21/2022" SelectByDefault="false" />  
       </Restriction>  
      </ClaimType>  
      
    2. Look for the technical profile <TechnicalProfile Id="LocalAccountSignUpWithLogonPhoneNumber"> in your B2C_1A_Phone_Email_Base policy file and add below tags:
      <DisplayClaims>  
       ...  
           <DisplayClaim ClaimTypeReferenceId="TnCs" Required="true" />  
      </DisplayClaims>  
      <OutputClaims>  
       ...  
       <OutputClaim ClaimTypeReferenceId="TnCs" Required="true" />  
      </OutputClaims>  
      
    3. Open the B2C_1A_SignUpOrSignInWithPhone policy file and add it as output claim under <TechnicalProfile Id="PolicyProfile"> , as shown below:
      <TechnicalProfile Id="PolicyProfile">  
            <DisplayName>PolicyProfile</DisplayName>  
            <Protocol Name="OpenIdConnect" />  
            <OutputClaims>  
               ...  
       <OutputClaim ClaimTypeReferenceId="TnCs"/>  
            </OutputClaims>  
            <SubjectNamingInfo ClaimType="sub" />  
      </TechnicalProfile>  
      
    4. After the signup is completed, you will get the below claim in the token. You can set the value in step 1, where you define the claim.
      195057-image.png

    To see this in action, Click Here and signup for a new account.

    -----------------------------------------------------------------------------------------------------------

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful