用facebook登录后在azure活动目录中创建用户 [英] create user in azure active directory after login with facebook

查看:75
本文介绍了用facebook登录后在azure活动目录中创建用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个天蓝色的移动应用程序(Xamarin android),该应用程序通过Facebook进行身份验证/授权,一切都已设置并在我的移动应用程序上正常工作,我可以在Facebook上进行身份验证并获得访问令牌. 使用该访问令牌,我使用以下代码登录了Azure移动服务

I have an azure mobile app (Xamarin android) that uses authentication/authorization with facebook, everything is setup and working on my mobile app, I’m able to authenticate with facebook and get an access token. with that access token I login in azure mobile services using the following code

MobileServiceClient Client;
var facebookToken = AccessToken.CurrentAccessToken.Token;
var token = new JObject();
token["access_token"] = facebookToken;
var user  = await Client.LoginAsync(MobileServiceAuthenticationProvider.Facebook, token);

我可以登录并从azure移动服务获取访问令牌.我面临的问题是,上面的代码无法在azure活动目录中创建用户.

I’m able to login and get an access token from azure mobile service. The problem I’m facing is that the above code does not create a user in the azure active directory.

当用户使用Facebook登录时,如何在azure活动目录中创建用户?

How can I create the user in the azure active directory when the user is login with facebook?

推荐答案

将Facebook用户添加到Azure AD没有任何意义.基本上,他们是两个不同的身份提供者.通过 Azure AD ,您可以使用Microsoft工作或学校帐户安全地登录用户.

It does not make sense to add the Facebook user to Azure AD. Basically, they are two different identity providers. Azure AD enables you to securely sign in users with a Microsoft work or school account.

对于您的情况,我建议您在任何人登录后将用户保存在数据库中.关于如何执行此操作的方法,您可以查看以下内容: Facebook登录流程&最佳做法.

For your scenario, I'd recommend you save the user in the database after anyone that signed in. About how to do that you can check this out: Facebook Login Flow & Best Practices.

这篇关于用facebook登录后在azure活动目录中创建用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆