User info not loading into firebase auth

孤者浪人 提交于 2019-12-13 14:45:20

问题


I am trying to create a very simple login with Facebook using firebase and android studio. My login with Facebook works and I was able to run the app and sign in but none of my info has been stored in firebase (I want to have the persons name, email, etc.) I know it's something small I am probably missing but I cannot figure it out and I have tried so many things. Also I checked and all my gradle files are up to date and my firebase is set up correctly so it has nothing to do with that. plz help.

firebaseAuth = FirebaseAuth.getInstance();
    firebaseAuthListner = new FirebaseAuth.AuthStateListener(){
        @Override
        public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
            FirebaseUser user = firebaseAuth.getCurrentUser();


            if(user != null){

      // what do i put here to pull out the fb users info into firebase?!

                goMainScreen();
            }
        }
    };

I have tried:

if(user != null){
String name = user.getDisplayName();
String email = user.getEmail();
String uid = user.getUid();

I have tried:

if (user != null) {
            // User is signed in
            Log.d(TAG, "onAuthStateChanged:signed_in:" + user.getUid());
        } else {
            // User is signed out
            Log.d(TAG, "onAuthStateChanged:signed_out");
        }

I know it is probably a dumb mistake because I am new to firebase and android studio but any advice will help. Thank you


回答1:


Are your user stored into the firebase console? (https://console.firebase.google.com)

If it is not stored in your project, it will not return anything when you call the getDisplayName(), getUser(), etc.

If they are stored, please post the complete code that you are using to do the login.



来源:https://stackoverflow.com/questions/42938163/user-info-not-loading-into-firebase-auth

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!