Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Xamarin.Forms Google API Authenticating Users with an Identity Provider

I am still getting used to Xamarin.Forms and I am on very basic level. I went through many articles for my issue, but to the end couldn't resolve it. So...

Currently I am trying to add Google authentication inside my Xamarin.Forms application, which use Droid and iOS (no WP). So far I am following guide from here. I am using Xamarin.Auth to authenticate to Google.

Here is some part from my source code.

The problem is coming after my method complete it's work. So after my last line:


everything looks alright and debugging I am following that compiler goes out of method without any errors, but then I receive exception, which you can see here. It's "No compatible code running".

Here some more information regarding my source code:

  • Source of "Constants" class used for client ids and URLs
  • Source of implemented methods for on authentication complete/error, which in fact still I cannot hit because of my error
  • Source of Android MainActivity where I added

global::Xamarin.Auth.Presenters.XamarinAndroid.AuthenticationConfiguration.Init(this, bundle);

Source of UrlSchemeInterceptorActivity
Here are the main articles I went through deeply => Link 1, Link 2 and Link 3, but still couldn't resolve the issue.

I am not sure where the error comes from, or can I can I continue debugging it to resolve issue.

Thanks in advance

Best Answer


  • Accepted Answer

    Found solution, I provide it here

  • Hello Nikola,

    When i following your sample, "AuthenticationState" in both places show no package related to.

    1. PCL: AuthenticationState.Authenticator = authenticator;

    2. Droid: AuthenticationState.OnPageLoading(uri);

    Complier reports:
    Error CS0103 The name 'AuthenticationState' does not exist in the current context

    Could u tell me what package it related to? thanks.

  • StephensinclairStephensinclair USMember ✭✭

    Did you find out where AuthenticationState resolves too?

  • ClayBrinleeClayBrinlee USMember ✭✭

    it's a class in the pcl that you have to add, it's not found in your native assemblies.

    it's simply this:

    using Xamarin.Auth;
    namespace YourPCLNamespace
        public class AuthenticationState
            public static OAuth2Authenticator Authenticator;
Sign In or Register to comment.