2
我对Xamarin和Azure Active Directory有点新,所以请耐心等待。尝试从Azure Active Directory检索用户信息(名字,姓氏和图片)时遇到问题。请注意,Azure Active Directory中的电子邮件是Google帐户。如何从Azure Active Directory检索用户信息
每当我尝试检索它,我只会得到一个错误,它需要我再次验证以检索我想要的。这里是我的代码:
// Use MobileServices Login to authenticate user
private async Task<bool> AuthenticateUsingMobileServices(Activity activity)
{
var success = false;
try
{
// Sign in with Active Directory
MobileUser = await MobileService.LoginAsync(activity,
MobileServiceAuthenticationProvider.WindowsAzureActiveDirectory);
System.Diagnostics.Debug.WriteLine("you are now logged in - Logged in!");
System.Diagnostics.Debug.WriteLine([insert user name here]);
success = true;
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("Authentication failed " + ex.ToString());
}
}
我已经试过除了加入这个我已经定义ResourceUri和客户端Id:
AuthenticationContext authContext = new AuthenticationContext(CommonAuthority);
AuthResult = await authContext.AcquireTokenAsync(ResourceUri, ClientId, UserCredential);
但我上放什么的ClientAssertion或UserAssertion一无所知。