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

Getting Plugin.GoogleClient.Shared.GoogleClientBaseException in android project

$
0
0

I am trying to add GoogleLogin in the application but getting this error

{Plugin.GoogleClient.Shared.GoogleClientBaseException: 10:
at Plugin.GoogleClient.GoogleClientManager.LoginAsync () [0x000cb] in <83ed24c9c5a7433abaaefc1fcc35c1f0>:0
at PlugAndPlay.ViewModel.MainPageViewModel.LoginGoogleAsync (PlugAndPlay.AuthNetwork authNetwork) [0x000ed] in F:\Apps\PlugAndPlay\PlugAndPlay\ViewModel\MainPageViewModel.cs:182 }

Here is the code-->

try
            {
             if (!string.IsNullOrEmpty(_googleService.AccessToken))
             {
                //Always require user authentication
                   _googleService.Logout();
               }

              EventHandler<GoogleClientResultEventArgs<GoogleUser>> userLoginDelegate = null;
             userLoginDelegate = async (object sender, GoogleClientResultEventArgs<GoogleUser> e) =>
             {
                    switch (e.Status)
                    {
                        case GoogleActionStatus.Completed:

if DEBUG

                           var googleUserString = JsonConvert.SerializeObject(e.Data);
                           Debug.WriteLine($"Google Logged in succesfully: {googleUserString}");

endif

                           var socialLoginData = new NetworkAuthData
                           {
                              Id = e.Data.Id,
                             Logo = authNetwork.Icon,
                             Foreground = authNetwork.Foreground,
                             Background = authNetwork.Background,
                                Picture = e.Data.Picture.AbsoluteUri,
                                Name = e.Data.Name,
                          };

                           await App.Current.MainPage.Navigation.PushModalAsync(new HomePage(socialLoginData));
                           break;
                       case GoogleActionStatus.Canceled:
                          await App.Current.MainPage.DisplayAlert("Google Auth", "Canceled", "Ok");
                         break;
                     case GoogleActionStatus.Error:
                           await App.Current.MainPage.DisplayAlert("Google Auth", "Error", "Ok");
                           break;
                    case GoogleActionStatus.Unauthorized:
                              await App.Current.MainPage.DisplayAlert("Google Auth", "Unauthorized", "Ok");
                          break;
                  }

                       _googleService.OnLogin -= userLoginDelegate;
               };

              _googleService.OnLogin += userLoginDelegate;

              await _googleService.LoginAsync();
          }
          catch (Exception ex)
          {
             Debug.WriteLine(ex.ToString());
          }

I don't know what is wrong with this code.

Any Help?


Viewing all articles
Browse latest Browse all 77050

Trending Articles



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