[英]How can i login to Firebase using the details of email authentication
How can i use the details of the firebase email authentication sign in instead of me using the email and password i added myself.. 我如何使用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");
}
}
});
}
Like the Firebase documentation said : 就像Firebase文档所说:
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
if (user != null) {
// User is signed in
} else {
// No user is signed in
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.