2

I'm currently using built-in attributes.
I'd like to get the "age_range" and "gender" from the FB.
Do I need to deal with custom policies as explained in the following topic:

how to get Facebook profile picture using Azure AD B2C how to get Facebook profile picture using Azure AD B2C
to get them?

Thanks!

NikolaiT
  • 106
  • 6

1 Answers1

4

Yes, you will have to create a custom policy for that, and then:

1: Declare the "ageRange" and "gender" claim types in the extension file.

2: Add both the "age_range" and "gender" fields to the "ClaimsEndpoint" metadata item and the "ageRange" and "gender" output claims to the "Facebook-OAUTH" technical profile.

3: Issue the "ageRange" and "gender" claims in the relying party file.

If you are wanting to save the "age_range" and "gender" fields from Facebook as attributes to Azure AD B2C, then you must:

1: Follow the Azure Active Directory B2C: Creating and using custom attributes in a custom profile edit policy steps to create the custom attributes for "AgeRange" and "Gender".

2: Change the claim type declarations, as well as all other references to them, from "ageRange" and "gender" to "extension_AgeRange" and "extension_Gender".

3: Add the "extension_AgeRange" and "extension_Gender" claims in the extension file to the "AAD-UserWriteUsingAlternativeSecurityId" and "AAD-UserReadUsingAlternativeSecurityId" technical profile:

<ClaimsProvider>
  <DisplayName>Facebook</DisplayName>
  <TechnicalProfiles>
    <TechnicalProfile Id="AAD-UserReadUsingAlternativeSecurityId">
      <OutputClaims>
        <OutputClaim ClaimTypeReferenceId="extension_AgeRange" />
        <OutputClaim ClaimTypeReferenceId="extension_Gender" />
      </OutputClaims>
    </TechnicalProfile>
    <TechnicalProfile Id="AAD-UserWriteUsingAlternativeSecurityId">
      <PersistedClaims>
        <PersistedClaim ClaimTypeReferenceId="extension_AgeRange" />
        <PersistedClaim ClaimTypeReferenceId="extension_Gender" />
      </PersistedClaims>
    </TechnicalProfile>
  </TechnicalProfiles>
</ClaimsProvider>
Chris Padgett
  • 14,186
  • 1
  • 15
  • 28
  • Thanks for the confirmation! I'm surprised they are not part of the built-in attributes – NikolaiT Feb 15 '18 at 03:40
  • No problems @NikolaiT. They aren't built-in attributes because, by default, they aren't standard properties for a user object in an Azure AD directory. If the above answer helps you, then can you please mark it so? – Chris Padgett Feb 15 '18 at 22:19