Xamarin.Auth not completed.

CenkGnCenkGn USMember

Hi everyone, I am developing an application with Xamarin.Android and i needed login system. Therefore i'm using Xamarin.Auth. I create a OAuth2Authenticator but not working auth.completed .

public void LoginToSabis()
        {
            var auth = new OAuth2Authenticator(
                clientId: "example_android",
                scope: "read",
                authorizeUrl: new Uri("example/authorize"),
                redirectUrl: new Uri("ex/callback"));

            auth.AllowCancel = true;



        // If authorization succeeds or is canceled, .Completed will be fired. BUT WHEN SUCCEEDS NOT WORKING, WHEN CANCELED WORKING...
        auth.Completed += async (s, ee) =>
        {


            if (!ee.IsAuthenticated)
            {

                var builder = new Android.Support.V7.App.AlertDialog.Builder(this);
                builder.SetMessage("Not Authenticated");
                builder.SetPositiveButton("Ok", (o, e) => { });
                builder.Create().Show();
                return;
            }

            AccountStore.Create(Application.Context).Save(ee.Account, "cg");
            StartActivity(typeof(LoginRedirectActivity));
        };

}`

Sign In or Register to comment.