2016-11-24 201 views
0

我越来越像一个错误:火力地堡验证错误的Android

Projects created at console.firebase.google.com must use the new Firebase Authentication SDKs available from firebase.google.com/docs/auth/ 

当我打电话:

Firebase authenticateUser = new Firebase(ReferenceUrl.FIREBASE_CHAT_URL); // Get app main firebase url 
       authenticateUser.authWithPassword(userName, passWord, authResultHandler); 

我已经创造了火力地堡的项目,并在应用程序模块添加的JSON文件并加入 编译com.google.firebase:firebase-core:9.8.0 库也请帮忙

回答

0

以下使用方法验证firebase登录:

FirebaseAuth.getInstance().signInWithEmailAndPassword(email,password).addOnCompleteListener(this, new OnCompleteListener<AuthResult>() { 
       @Override 
       public void onComplete(@NonNull Task<AuthResult> task) { 
        if (task.isSuccessful()) { 
         //display some message here 
         Toast.makeText(Registration.this, "Successfully Signed In", Toast.LENGTH_LONG).show(); 
        } else { 
         //display some message here 
         Toast.makeText(Registration.this, "Signed In Error", Toast.LENGTH_LONG).show(); 
        } 
       } 
      }); 

希望这会对你有所帮助。

+0

它正在工作,但我想使用 –

+0

登录Firebase authenticateUser = new Firebase(ReferenceUrl.FIREBASE_CHAT_URL); //获取应用主Firebase网址 authenticateUser.authWithPassword(userName,passWord,authResultHandler);此方法 –

+0

@KunalDudka使用Amrut Bidri给出的方法后,您需要检查auth状态以检查用户是否登录。如果用户正确登录,则authstate将会更改。请查看:https://firebase.google.com/docs/auth/android/start/。顺便说一下,我第一次看到您的身份验证方法,请您在文档中提供一个参考资料吗? –