displayName showing null after creating user with Firebase Auth

前端 未结 2 1174
予麋鹿
予麋鹿 2021-01-06 15:47

I\'m trying to add a user using the Firebase auth and it returns the displayName as null, even though it asks for it via the UI on sign up. Any ideas why and how to fix? H

相关标签:
2条回答
  • 2021-01-06 16:15

    You Can Also Get Name From firebaseAuthWithGoogle Method.

      private void firebaseAuthWithGoogle(final GoogleSignInAccount acct) {
      AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
        mAuth.signInWithCredential(credential)
                .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                    @Override
                    public void onComplete(@NonNull Task<AuthResult> task) {
    
                        if (!task.isSuccessful()) {
    
                            Toast.makeText(MainActivity.this, "Authentication failed.",
                                    Toast.LENGTH_SHORT).show();
                        } else {
                            System.out.println(acct.getDisplayName());
                            System.out.println(acct.getPhotoUrl());
                        }
    
                    }
                }); }
    
    0 讨论(0)
  • 2021-01-06 16:30

    So this appears to be (now known) bug in the Firebase itself (Not Firebase-UI). The bug appears to be introduced with version Firebase Android SDK v9.8.0. For the time being one of the workarounds is to force users to logout and re-login after they have registered with system. The other involves downgrading FirebaseUI to the version which uses older Firebase SDK version. Source: https://github.com/firebase/FirebaseUI-Android/issues/409

    0 讨论(0)
提交回复
热议问题