private void AuthCallback(ILoginResult result) { var socialUser = new SocialUser(); if (FB.IsLoggedIn) { // AccessToken class will have session details var aToken = AccessToken.CurrentAccessToken; // Print current access token's User ID Debug.Log($"{DefineContain.DebugFacebook} AccessToken: {aToken.UserId}"); // Print current access token's granted permissions foreach (string perm in aToken.Permissions) { Debug.Log($"{DefineContain.DebugFacebook} Permission: {perm}"); } socialUser.uid = aToken.UserId; socialUser.token = aToken.TokenString; loginCallback?.Invoke(EnumLoginState.Success, socialUser); } else { Debug.LogError($"{DefineContain.DebugFacebook} Login error"); loginCallback?.Invoke(EnumLoginState.Error, socialUser); } }
public virtual void Initialize(Action <EnumLoginState, SocialUser> callback) { loginCallback = callback; credentialUser = new SocialUser { email = $"{SystemInfo.deviceName}@gmail.com", password = SystemInfo.deviceUniqueIdentifier, }; }
SocialUser CopyToSocialUser(FirebaseUser user) { var socialUser = new SocialUser(); socialUser.uid = user.UserId ?? ""; socialUser.userName = user.DisplayName ?? ""; socialUser.avatar = user.PhotoUrl?.ToString(); socialUser.email = user.Email ?? ""; socialUser.code = user.ProviderId ?? ""; return(socialUser); }