用户信息未加载到Firebase身份验证 [英] User info not loading into firebase auth

查看:172
本文介绍了用户信息未加载到Firebase身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用firebase和android studio创建一个非常简单的Facebook登录。我登录Facebook的工程,我能够运行应用程序和登录,但没有我的信息已经存储在firebase(我想要的人名,电子邮件等)我知道这是一个小的,我可能会失踪,但我想不出来,我尝试了很多东西。此外,我检查了所有我的gradle文件是最新的,我的firebase设置正确,所以它没有任何关系。 plz help。

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


if(user!= null){

//我在这里把fb的用户信息放到firebase里面?

goMainScreen();
}
}
};

我试过了:

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

我试过了:

  if(user!= null){
//用户登录
Log.d(TAG,onAuthStateChanged:signed_in:+ user.getUid());
} else {
//用户签出
Log.d(TAG,onAuthStateChanged:signed_out);



$ b

我知道这可能是一个愚蠢的错误,因为我是firebase和android工作室,但任何意见将有所帮助谢谢

解决方案

您的用户是否存储在Firebase控制台中? ( https://console.firebase.google.com



如果它没有存储在你的项目中,当你调用getDisplayName(),getUser()等时,它将不会返回任何东西。



他们被存储,请张贴你正在使用的完整代码进行登录。


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

解决方案

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.

这篇关于用户信息未加载到Firebase身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆