skip to Main Content

I’m developing a Xamarin app that uses Azure AD B2C and I’m having some trouble.

Even though I have LinkedIn, Google, Microsoft, Facebook, and Twitter setup as Identity Providers, the only thing I am ever prompted for is my Microsoft account. I don’t see any of the other buttons when my app invokes the login. Works great for Microsoft login, can’t access any of the others.

Here is my call to AcquireTokenAsync:

var result = await AuthenticationClient.AcquireTokenAsync(Constants.Scopes, 
    GetUserByPolicy(App.AuthenticationClient.Users, Constants.PolicySignUpSignIn), 
    Evaluator.App.UiParent);

In the Azure AD B2C settings in the portal, I have Web App / Web API set to NO, Native client set to YES. The Custom Redirect URI is “masl{myappid}://auth”.
Under Keys it says “No results”.
Under API access (Preview) it says there are 2 scopes (both checkboxes checked for openid and offline_access).
Under published scopes (Preview) it says Web app / Web API has not been included.

Under Identity providers, I have LinkedIn, Google, Microsoft, Facebook, and Twitter configured.

2

Answers


  1. Chosen as BEST ANSWER

    It turns out that changing to use one of the other overloads of AcquireTokenAsync causes different behavior.

    var result = //await AuthenticationClient.AcquireTokenAsync(Constants.Scopes, GetUserByPolicy(App.AuthenticationClient.Users, Constants.PolicySignUpSignIn), Evaluator.App.UiParent);
        await App.AuthenticationClient.AcquireTokenAsync(Constants.Scopes, GetUserByPolicy(App.AuthenticationClient.Users, Constants.PolicySignUpSignIn), UIBehavior.SelectAccount, string.Empty, null, Constants.Authority, App.UiParent);
    

    The original call caused the Azure AD service to be called, and the call shown here causes the Azure B2C service to be called instead. I don't see that documented anywhere, and I wish all the overloads had better documentation describing the relevance and distinctions in behavior between them.

    Now I see all the providers I had configured showing up as options! However, there's a new problem in that (despite the fact that they appear to be configured correctly) I no longer get an email address back in the result.User.DisplayableId field. Despite this, my original question is answered.


  2. Configure your Policy Identity Providers (IDPs)

    configure policy idps screenshot

    Sample Policy

    login screenshot

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search