0

I have a custom policy which I'm using to login with B2C. In the code I need the firtname, lastname, email of the user. How can I get these information from the custom policy?

I have tried to add in the TrusetdFrameworkExtension in the OutputClaim node:

 <OutputClaims>
    <OutputClaim ClaimTypeReferenceId="displayName" />
    <OutputClaim ClaimTypeReferenceId="givenName" />
    <OutputClaim ClaimTypeReferenceId="surname" />
    <OutputClaim ClaimTypeReferenceId="email" />
    <OutputClaim ClaimTypeReferenceId="objectId" PartnerClaimType="sub" />
    <OutputClaim ClaimTypeReferenceId="identityProvider" />
  </OutputClaims>

but without success. Any idea is appreciated. Thanks

Kar
  • 311
  • 3
  • 7
  • 16
  • Check this out - https://learn.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-create-custom-attributes-profile-edit-custom – Mohit_Garg Sep 25 '18 at 00:26
  • Also for email refer to this - https://stackoverflow.com/questions/46778129/azure-ad-b2c-emails-claim-in-custom-policy – Mohit_Garg Sep 25 '18 at 00:27
  • Are you using [the starter pack](https://github.com/Azure-Samples/active-directory-b2c-custom-policy-starterpack)? If so, then you must add the output claims to [the relying party definition](https://learn.microsoft.com/en-us/azure/active-directory-b2c/relyingparty) as well, such as [this sample file](https://github.com/Azure-Samples/active-directory-b2c-custom-policy-starterpack/blob/master/SocialAndLocalAccounts/SignUpOrSignin.xml). – Chris Padgett Sep 25 '18 at 04:59

1 Answers1

0

You have to define these claimsoutput in you TrusetdFrameworkExtension.xml file and then you have to define userinfo endpoint in signinsignup.xml file under tag i.e:

   <DefaultUserJourney>
     <Endpoints>
       <Endpoint Id="UserInfo" UserJourneyReferenceId="UserInfoJourney" />
     </Endpoints> 

After adding the endpoint, add the outputclaims inside <TechnicalProfile> tag and you're good to go.

ouflak
  • 2,458
  • 10
  • 44
  • 49