Пример #1
0
 public void DidSignIn(SignIn signIn, Google.SignIn.GoogleUser user, NSError error)
 {
     if (user != null && error == null)
     {
         _onLoginComplete?.Invoke(new GoogleUser()
         {
             Name    = user.Profile.Name,
             Email   = user.Profile.Email,
             Picture = user.Profile.HasImage ? new Uri(user.Profile.GetImageUrl(500).ToString()) : new Uri(string.Empty)
         }, string.Empty);
     }
     else
     {
         _onLoginComplete?.Invoke(null, error.LocalizedDescription);
     }
 }
        public override void DidSignIn(SignIn signIn, Google.SignIn.GoogleUser user, NSError error)
        {
            if (error != null)
            {
                OnError?.Invoke(this, new Error()
                {
                    Message = error.LocalizedDescription
                });
                return;
            }


            var authCode = user.ServerAuthCode;

            if (!string.IsNullOrEmpty(authCode))
            {
                OnAuthCodeReceived?.Invoke(this, authCode);
            }
            else
            {
                OnLogin?.Invoke(this, new Data.GoogleUser()
                {
                    Id              = user.UserId,
                    DisplayName     = user.Profile.Name,
                    IdToken         = user.Authentication.IdToken,
                    Base            = user,
                    AuthCode        = user.ServerAuthCode,
                    Email           = user.Profile.Email,
                    FamilyName      = user.Profile.Email,
                    GivenName       = user.Profile.GivenName,
                    GrantedScopes   = user.GrantedScopes.ToArray(),
                    RequestedScopes = new string[] {},
                    PhotoUrl        = user.Profile.GetImageUrl(512).ToString(),
                });
            }
        }
Пример #3
0
 public void DidDisconnect(SignIn signIn, Google.SignIn.GoogleUser user, NSError error)
 {
     // Perform any operations when the user disconnects from app here.
 }