Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

How to use Xamarin OAuth Presenters Login method for Google

$
0
0

Hi All,

I am using the Xamarin OAuth2 Presenters method to enable google plus login in my xamarin application, since the webviews are now disavowed by Google to authenticate the user information through the mobile devices. I have followed the method as per the sample in this link.
https://developer.xamarin.com/guides/xamarin-forms/cloud-services/authentication/oauth/#Setup

And I am getting the null exception method at the calling of the Login method from the presenter to show the login page to the user to authenticate their credentials. Getting the error in the below bold line of the code.

var authenticator
= new Xamarin.Auth.OAuth2Authenticator
(
clientId: GoogleServices.ClientId,
clientSecret: null,
scope: "https://www.googleapis.com/auth/userinfo.profile",
authorizeUrl: new Uri("https://accounts.google.com/o/oauth2/auth"),
redirectUrl: new Uri(GoogleServices.RedirectUri),
accessTokenUrl: new Uri("https://www.googleapis.com/oauth2/v4/token"),
getUsernameAsync: null,
isUsingNativeUI : true
);

var presenter = new Xamarin.Auth.Presenters.OAuthLoginPresenter();
**presenter.Login(authenticator); **

Find the attached image of the exception i am getting.

Let me know how to clear this exception. I have also found a sample from the GitHub link for the OAuth authentication, https://github.com/moljac/Xamarin.Auth.Samples.NugetReferences but it is not compiling in Visual Studio throwing numerous errors.

Thanks,
Vijayakumar Y.


Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>