public async Task <GoogleSignInResult> Authenticate(IGoogleAuthOptions options)
            {
                var googleScopes = options?.Scopes?.Select(s => new Scope(s))?.ToArray();

                var gsoBuilder = new GoogleSignInOptions.Builder(GoogleSignInOptions.DefaultSignIn);

                if (!string.IsNullOrEmpty(options.ServerClientId))
                {
                    gsoBuilder = gsoBuilder.RequestIdToken(options.ServerClientId);
                }

                if (googleScopes != null && googleScopes.Any())
                {
                    gsoBuilder = gsoBuilder.RequestScopes(googleScopes.First(), googleScopes.Skip(1).ToArray());
                }

                if (options.FetchProfile)
                {
                    gsoBuilder = gsoBuilder.RequestProfile().RequestEmail();
                }

                var gso = gsoBuilder.Build();

                var activity = Plugin.SocialAuth.Droid.SocialAuth.CurrentActivity;

                googleApiClient = new GoogleApiClient.Builder(activity)
                                  .EnableAutoManage(activity, 789, this)
                                  .AddConnectionCallbacks(this)
                                  .AddApi(Auth.GOOGLE_SIGN_IN_API, gso)
                                  .Build();

                googleApiClient.Connect();

                tcsSignIn = new TaskCompletionSource <GoogleSignInResult>();

                var result = await tcsSignIn.Task;

                googleApiClient.StopAutoManage(activity);

                return(result);
            }
 public static Task <IGoogleAccount> AuthenticateGoogleAsync(this SocialAuthManager manager, IGoogleAuthOptions options, string accountId = null)
 {
     return(manager.AuthenticateAsync <IGoogleAccount, IGoogleAuthOptions>(ProviderType.Google, options, accountId));
 }