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一無所知。