Я работаю над outlook rest Api для доступа к контактам в Xamarin. ios родное приложение. Я использую библиотеку Xamarin.Auth для аутентификации. Я прочитал документ Microsoft для всех настроек, таких как Azure Active Directory и также настроен. Мое приложение iOS открывает окно проверки подлинности Microsoft, но после ввода идентификатора и пароля для входа в систему появляется ошибка « одна или несколько ошибок: invalid_request и invalid_grant ».
Outlook Api reference ссылка
Azure Active Directory
Пожалуйста, проверьте мой код и помогите мне решить эту проблему.
public override void ViewDidLoad()
{
base.ViewDidLoad();
AuthMsn = new OAuth2Authenticator(
clientId: "MyClientId",
scope: "https://outlook.office.com/contacts.read",
authorizeUrl: new Uri("https://login.microsoftonline.com/common/oauth2/v2.0/authorize"),
redirectUrl: new Uri("msauth.com.MyApp.MsnContactDemo://auth"),
accessTokenUrl: new Uri("https://login.microsoftonline.com/common/oauth2/v2.0/token"),
clientSecret:"MyClientSecret"
);
BeginInvokeOnMainThread(() =>
{
var viewController = AuthMsn.GetUI();
PresentViewController(viewController, true, null);
});
AuthMsn.Completed += AuthMsn_Completed;
AuthMsn.Error += AuthMsn_Error;
}
private void AuthMsn_Completed(object sender, AuthenticatorCompletedEventArgs e)
{
if (e.IsAuthenticated)
{
}
}
private void AuthMsn_Error(object sender, AuthenticatorErrorEventArgs e)
{
var a= e.Exception;
}