[英]Xamarin.Forms app using Azure AD B2C only showing Microsoft login
I'm developing a Xamarin app that uses Azure AD B2C and I'm having some trouble. 我正在开发使用Azure AD B2C的Xamarin应用程序,但遇到了一些麻烦。
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. 即使我将LinkedIn,Google,Microsoft,Facebook和Twitter设置为身份提供者,但我唯一得到的提示还是我的Microsoft帐户。 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. 非常适合Microsoft登录,不能访问其他任何一个。
Here is my call to AcquireTokenAsync: 这是我对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. 在门户网站的Azure AD B2C设置中,我将Web App / Web API设置为NO,将本机客户端设置为YES。 The Custom Redirect URI is “masl{myappid}://auth”. 自定义重定向URI为“ 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). 在“ API访问(预览)”下,它表示有2个作用域(两个复选框都选中了openid和offline_access)。 Under published scopes (Preview) it says Web app / Web API has not been included. 在已发布的范围(预览)下,它表示未包含Web应用程序/ Web API。
Under Identity providers, I have LinkedIn, Google, Microsoft, Facebook, and Twitter configured. 在身份提供者下,我配置了LinkedIn,Google,Microsoft,Facebook和Twitter。
It turns out that changing to use one of the other overloads of AcquireTokenAsync causes different behavior. 事实证明,更改为使用AcquireTokenAsync的其他重载之一会导致不同的行为。
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. 原始调用导致调用Azure AD服务,此处显示的调用导致调用Azure B2C服务。 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. 但是,存在一个新问题(尽管它们似乎配置正确),我再也没有在result.User.DisplayableId
字段中获取电子邮件地址。 Despite this, my original question is answered. 尽管如此,我的原始问题得到了回答。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.