How to consume direct link to identity provider with azure B2C?

Phenek 116 Reputation points
2021-09-09T13:10:31.36+00:00

Hello,

I would like to consume third party identity provider in my application.
B2C provide a MSAL WebView authentication with pre-generated or custom page layout (with username, password, and button for social providers).
like below
130707-screenshot-2021-09-09-at-145924.png

But I would like to create my own native button, that will open directly the web view on a specific identity provider.
Does Microsoft provide such flow without using the pre-generated or custom page layout, but redirect instantly to the Identity provider?

If Microsoft does not, where can suggest new feature, enhancement and vote for them?

Let me know,
Regards :)

Developer technologies | .NET | Xamarin
Microsoft Security | Microsoft Entra | Microsoft Entra External ID
0 comments No comments
{count} vote

Accepted answer
  1. Phenek 116 Reputation points
    2021-09-10T08:11:11.707+00:00

    The goal is to use the domain_hint parameter
    For example if the application specifies domain_hint=facebook.com, sign-in goes directly to the Facebook sign-in page.

    Url Parameter:

    "https://{tenant}.b2clogin.com/{tenant}.onmicrosoft.com/{policy}/oauth2/v2.0/authorize?client_id{ClientId}&response_type=code&scope={Scope}&domain_hint=facebook.com"  
    

    Code:

    let loginRequest = {  
         extraQueryParameters: {domain_hint: 'facebook.com'}  
    }  
    myMSALObj.loginPopup(loginRequest);  
    

    Here two Microsoft doc links that explain how to do it.

    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Kyle Wang 5,531 Reputation points Microsoft External Staff
    2021-09-10T05:26:05.59+00:00

    Hi VicePhenek-7065,

    Welcome to our Microsoft Q&A platform!

    To achieve authentication, Xamarin.Forms provides the Xamarin.Essentials: Web Authenticator.

    There are also some Nuget packages, such as Microsoft.Identity.Client and Xamarin.Auth, you can refer to.

    If you have any feature request, you can submit on GitHub: xamarin/Xamarin.Forms.

    Regards,
    Kyle


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

  2. Phenek 116 Reputation points
    2021-09-10T08:02:02.703+00:00

    Hi @Kyle Wang ,

    Thanks I am glad to have a Community expert to this topic.
    I have already a question about Web Authenticator.
    And I don't think this feature about B2C should be submitted to Xamarin.forms GitHub (even if they have ended all enhancement to the profit of maui)

    We would prefer any B2C GitHub,
    because my question was all about B2C and it's available User Flow and specifically how to preselect an identity provider?

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.