Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Ad b2c: Get email in Claims after successfully Signin in azure ad b2c

I am using starter pack of custom polices with SocialAndLocalAccounts pack.

It is working fine for me.

But I am facing one issue.I need to get email as claim after successfully login. I am getting email as claim, once user has been been signed-up and redirects back immediately to application.

but I am not getting it when a user simply signs-in.

How can I get that? where do I need to write an Output Claim to get the value of email in claim?

Kindly help me. Thanks

like image 664
Tejinder Singh Avatar asked Jul 15 '18 22:07

Tejinder Singh


People also ask

What are claims in Azure AD B2C?

Claims. When you use Azure AD B2C, you have fine-grained control over the content of your tokens. You can configure user flows and custom policies to send certain sets of user data in claims that are required for your application. These claims can include standard properties such as displayName and emailAddress.

Can I use Azure AD B2C features in my existing employee based Azure AD tenant?

Azure AD and Azure AD B2C are separate product offerings and cannot coexist in the same tenant. An Azure AD tenant represents an organization. An Azure AD B2C tenant represents a collection of identities to be used with relying party applications.

Is Azure B2C SSO?

Single sign-on (SSO) adds security and convenience when users sign in across applications in Azure Active Directory B2C (Azure AD B2C). This article describes the single sign-on methods used in Azure AD B2C and helps you choose the most appropriate SSO method when configuring your policy.


1 Answers

For Chris Padgett's answer, you can add other emails (Alternate email) into the claim.

If you just want to add email claim from the SignIn name into the token, you can just take following steps:

  1. Open your SignUporSignIn.xml file

  2. Replace <OutputClaim ClaimTypeReferenceId="email" /> with <OutputClaim ClaimTypeReferenceId="signInNames.emailAddress" PartnerClaimType="email" />

  3. Save this SignUporSignIn.xml file and upload it to Azure AD B2C to overwrite the policy.

  4. Run the SignUporSignIn policy to test it. Here is my test result, you can see the email claim in the token: enter image description here

Hope this helps.

like image 113
Wayne Yang Avatar answered Nov 15 '22 09:11

Wayne Yang