Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get login_hint working with social IDP using custom policy

We are using custom SignIn/SigUp Policy, configured Facebook, LinkedIn, Twitter, Google+ as Social IDP's.

We have built a custom page where we ask the user for their email and then redirect them to the particular IDP page (we have logic built around this) using domain_hint, for example: domain_hint=facebook.com.

I want to pass the email address entered by the user in the first step in login_hint along with domain_hint so that the user doesn't have to enter the email once again when redirected to the IDP Page (Facebook.com).

I took the code from the AD B2C documentation for IDP's and added as below in claims provider for Facebook, Linkedin, Twitter etc. which is not working

<InputClaims>
    <InputClaim ClaimTypeReferenceId="logonIdentifier" PartnerClaimType="login_hint" DefaultValue="{OIDC:LoginHint}" />
</InputClaims>
<OutputClaims>
    <OutputClaim ClaimTypeReferenceId="logonIdentifier" Required="true" />
</OutputClaims>

Is there a way/option to achieve this?

like image 774
Lucky Avatar asked Oct 18 '25 07:10

Lucky


1 Answers

For the above identity providers, Google is the only one that supports a login hint, so if you add the domain_hint and login_hint parameters to the Azure AD B2C request:

https://login.microsoftonline.com/te/<tenant>/<policy>/oauth2/v2.0/authorize?...&domain_hint=google.com&[email protected]

then you can pass the "login_hint" parameter through from Azure AD B2C to the Google endpoint as follows:

1) Create a "loginHint" claim type:

<ClaimType Id="loginHint">
  <DisplayName>Login Hint</DisplayName>
  <DataType>string</DataType>
</ClaimType>

2) Add the "loginHint" input claim to the Google technical profile:

<ClaimsProvider>
  <Domain>google.com</Domain>
  <DisplayName>Google Account</DisplayName>
  <TechnicalProfiles>
    <TechnicalProfile Id="GoogleAccount-OAuth2">
      <DisplayName>Google Account</DisplayName>
      <Protocol Name="OAuth2" />
      ...
      <InputClaims>
        <InputClaim ClaimTypeReferenceId="loginHint" PartnerClaimType="login_hint" DefaultValue="{OIDC:LoginHint}" />
      </InputClaims>
      ...
    </TechnicalProfile>
  </TechnicalProfiles>
</ClaimsProvider>
like image 126
Chris Padgett Avatar answered Oct 22 '25 05:10

Chris Padgett



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!