I'm using Xamarin.Auth version 1.5.0.3 in my xamarin.android and xamarin.ios (PCL) project for application authentication/login with facebook's OAuth API. The issue arises after I click on the "Not now" link (watch the screenshot below). I get the following error dialog:
Authentication Error e.Message = OAuth Error = Permissions+error
Is there any way to disable this link or to fix it somehow? Or does someone have an idea why this happens?
iOS code (which works now):
public override void ViewDidAppear(bool animated)
{
base.ViewDidAppear(animated);
var auth = new OAuth2Authenticator(
clientId: "myClientId",
scope: "",
authorizeUrl: new Uri("https://m.facebook.com/dialog/oauth/"),
redirectUrl: new Uri("https://www.facebook.com/connect/login_success.html"),
isUsingNativeUI: true
);
auth.Completed += (sender, eventArgs) =>
{
if (eventArgs.IsAuthenticated)
{
}
else
{
}
};
var errorWasAlreadyTrown = false;
auth.Error += (object sender, AuthenticatorErrorEventArgs eventArgs) =>
{
if (!errorWasAlreadyTrown)
{
OAuth2Authenticator auth2 = (OAuth2Authenticator)sender;
auth2.ShowErrors = false;
App.SuccessfulLoginAction.Invoke();
errorWasAlreadyTrown = true;
}
};
PresentViewController(auth.GetUI(), true, null);
}
But it still doesn't work on Android. All the code is the same, except on iOS i override the "ViewDidAppear" method and on android the "OnElementChanged" method. And at the end i call "PresentViewController" on iOS and "activity.StartActivity" on Android.
I followed some instructions here: How to login to facebook in Xamarin.Forms