How to get userID by user Email Firebase android?

前端 未结 5 1636
夕颜
夕颜 2020-12-29 11:58

Given a email address, is it possbile to get userID of a person? For example,

If I have a variable email that has email of the person. Can I get their ID by doing so

5条回答
  •  有刺的猬
    2020-12-29 12:17

    Firebase do not provide user info on the basis of email. You can do one thing make login with your credential and after successful login use below code to get details of user.

    FirebaseUser currentFirebaseUser = FirebaseAuth.getInstance().getCurrentUser();
                                if(currentFirebaseUser !=null)
    
        {
            Log.d(TAG, "onComplete: currentUserUid---->" + currentFirebaseUser.getUid());
            Log.d(TAG, "onComplete: currentUserEmail---->" + currentFirebaseUser.getEmail());
            Log.d(TAG, "onComplete: currentUserDisplayName---->" + currentFirebaseUser.getDisplayName());
        } else
    
        {
            Log.d(TAG, "onComplete: currentUserUid is null");
        }
    

提交回复
热议问题