Azure的AD B2C指定Xamarin.Forms iOS应用程序的多个身份提供商 [英] Azure AD B2C Specify multiple Identity Providers in Xamarin.Forms iOS app
问题描述
我用下面的示例的iOS项目作为提供这里。
I have used the following sample iOS project as provided here.
该示例是pretty直线前进,我可以得到ADAL加载登录查看并请求用户认证,都好。
The sample is pretty straight forward and I can get ADAL to load the login view and request user authentication, all good.
现在,我打算把它一点点进一步显示具有多个身份提供者(G +,Twitter的,FB等)登录查看。
Now, I intend to take it a little further by showing a login view with multiple identity providers (G+, Twitter, Fb, etc).
在Web应用程序中,我可以看到多个身份提供商时,我请求认证,因为我们可以像这样指定在web.config中的策略:
In a web application, I can see multiple identity providers when I request for authentication as we can specify the policies in the web.config like so:
<add key="ida:Tenant" value="sometenant.onmicrosoft.com" />
<add key="ida:ClientId" value="clientidguid" />
<add key="ida:ClientSecret" value="clientsecret" />
<add key="ida:AadInstance" value="https://login.microsoftonline.com/{0}{1}{2}" />
<add key="ida:RedirectUri" value="https://localhost:44321/" />
<add key="ida:SignUpPolicyId" value="b2c_1_xyz_policy" />
<add key="ida:SignInPolicyId" value="b2c_1_xyz_sign_in" />
<add key="ida:UserProfilePolicyId" value="b2c_1_xyz_editing" />
我有我的应用程序所使用的相同的重定向URI(我也曾尝试使用本地客户端重定向URI没有运气)
I have the same redirect uri that I've used in the app (I have also tried to use the redirect uri for Native client with no luck )
我在想,我怎么指定一个Xamarin形式的项目策略,这样我可以看到用户登录多个身份提供商在我的iOS应用程序?
I was wondering, how do I specify policies in a Xamarin forms project so that I can see multiple identity providers for user sign-in in my iOS app?
在此先感谢!
推荐答案
我结束了由authContext.AcquireTokenAsync()方法指定extraQueryParameters这个解决自己。 <一href=\"https://azure.microsoft.com/en-us/documentation/articles/active-directory-b2c-reference-policies/\"相对=nofollow>这个帖子帮助拿出解决方案需要大量的。
I ended up resolving this myself by specifying the 'extraQueryParameters' in the authContext.AcquireTokenAsync() method. This post helped a great deal to come up with the required solution.
var authResult = await authContext.AcquireTokenAsync(resource, clientId, new Uri(returnUri), new PlatformParameters(UIApplication.SharedApplication.KeyWindow.RootViewController), UserIdentifier.AnyUser, "&scope=openid&p=B2C_1_xyz_sign_in");
范围是一个必需的参数和'P'参数指定要使用的策略。
The 'scope' was a required param and the 'p' param specifies the policy to use.
我现在有一个基于我在Azure的门户网站已经设置的政策可以登录我的应用程序的多个身份提供者。万岁! :)
I now have multiple identity providers available for sign-in in my app, based on the policy that I've setup in Azure portal. Hooray! :)
HTH ...
这篇关于Azure的AD B2C指定Xamarin.Forms iOS应用程序的多个身份提供商的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!