2016-11-24 231 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/。順便說一下,我第一次看到您的身份驗證方法,請您在文檔中提供一個參考資料嗎? –