Azure B2C Custom Policy - Detect user company based on email address and forward to their SSO provider

Huy Nguyen 51 Reputation points


I have successfully created a new Social login button on our B2C login screen for custom providers, but as we have more customers using our B2C logins, I would like to remove those social login buttons and auto detect the customer's company by their sign in email address and forward to their SSO provider's login page.

How can I do this with the Trust Framework Custom Policy?

Huy Nguyen

Azure Active Directory External Identities
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. FrankHu-MSFT 971 Reputation points

    Hey @Huy Nguyen you could utilize custom JavaScript that parses the username and performs the expected action accordingly. You can learn more about custom javascript and b2c here :

    For more reference on this see the sso reference page below.

    If you're interested in a more fleshed out solution from B2C in the portal or perhaps better documentation on how to do this, I suggest filing this as product feedback here :

    And if there's enough community support the product team will look into putting this on the roadmap to implement accordingly.

    3 people found this answer helpful.

  2. AmanpreetSingh-MSFT 55,531 Reputation points

    @Huy Nguyen You can use the sample: Sign In policy with Home Realm Discovery and a Default Identity Provider for this purpose.

    Note: This sample is in private preview. Make sure you test all scenarios before implementing it in your production environment.


    Please "mark as answer" or "vote as helpful" wherever the information provided helps you to help others in the community.

    1 person found this answer helpful.