繁体   English   中英

我如何使用电子邮件身份验证的详细信息登录Firebase

[英]How can i login to Firebase using the details of email authentication

我如何使用Firebase电子邮件身份验证的详细信息登录,而不是使用添加的电子邮件和密码登录。

   private void loginToFirebase() {
    String email = getString(R.string.firebase_email);
    String password = getString(R.string.firebase_password);
    // Authenticate with Firebase and subscribe to updates
    FirebaseAuth.getInstance().signInWithEmailAndPassword(
            email, password).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
        @Override
        public void onComplete(Task<AuthResult> task) {
            if (task.isSuccessful()) {
                subscribeToUpdates();
                Log.d(TAG, "firebase auth success");
            } else {
                Log.d(TAG, "firebase auth failed");
            }
        }
    });
} 

就像Firebase文档所说:

FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
if (user != null) {
// User is signed in
} else {
// No user is signed in
}

这是Firebase文档

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM