[英]How to retrieve user information from Azure Active Directory
我對Xamarin和Azure Active Directory有點陌生,所以請耐心等待。 我在嘗試從Azure Active Directory檢索用戶信息(名字,姓氏和圖片)時遇到麻煩。 請注意,Azure Active Directory中的電子郵件是Google帳戶。
每次嘗試檢索它時,我只會收到一個錯誤,它要求我對AGAIN進行身份驗證才能檢索我想要的內容。 這是我的代碼:
// 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和ClientId之外添加以下內容:
AuthenticationContext authContext = new AuthenticationContext(CommonAuthority);
AuthResult = await authContext.AcquireTokenAsync(ResourceUri, ClientId, UserCredential);
但是我對於將ClientAssertion或UserAssertion放入什么一無所知。
您要做的步驟是:
檢出: https : //blog.xamarin.com/authenticate-xamarin-mobile-apps-using-azure-active-directory/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.