问题
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);
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.
How can I create the user in the azure active directory when the user is login with facebook?
回答1:
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.
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.
来源:https://stackoverflow.com/questions/47926786/create-user-in-azure-active-directory-after-login-with-facebook