Xamarin.forms cannot convert from object to system.type with Xamarin.Auth and specific android platform

I am authenticating in a Xamarin.Forms app. I looked at this sample " TodoAWSAuth - Configuring Google as an OAuth Identity Provider ". In my android implementation of OAuthLoginPresenter I have this code: using Xamarin.Auth;

 namespace InstagramApp.Droid
 {
   public class OAuthLoginPresenter
   {
      public void Login(Authenticator authenticator)
      {
        Xamarin.Forms.Forms.Context.StartActivity(authenticator.GetUI(Xamarin.Forms.Forms.Context));
      }
   }
 }

      

My:

Xamarin.Forms.Forms.Context.StartActivity(authenticator.GetUI(Xamarin.Forms.Forms.Context));

      

returns me:

Argument 1: Cannot convert from 'object' to 'System.Type'

This is the same in the example in the link. What could be the problem?

Also in the Xamarin documentation the code is the same: Xamarin.Auth Documentation

Thanks everyone

+3


source to share


2 answers


* Edit: The API below has probably changed with Xamarin.Auth 1.5. See the answer to the moljack.

For me, I am using an action to run the login and submit page in context, but I also run the below code from the ContentPage

renderer method OnElementChanged()

:



Android.App.Activity activity = Context as Android.App.Activity;

//Initialize authenticator

activity.StartActivity(auth.GetUI(activity));

      

+1


source


Xamarin.Auth 1.4.x supports custom tabs and SafariViewController, but Xamarin.Forms doesn't support what most users want. Xamarin.Forms support in version 1.5.0-alpha will be released soon.

Samples pulled from the repo:

https://github.com/moljac/Xamarin.Auth.Samples.NugetReferences



ComicBook is Xamarin.Forms

Providers Traditional / Standard

They will give you an idea of ​​how to do this.

+1


source







All Articles