android - Firebase 电子邮件/密码身份验证从未完成
问题描述
我在我的 Android 应用程序中实现了 Firebase 提供的电子邮件/密码登录方法。它工作正常。但是今天由于某些我不知道的原因它没有工作。我没有更改与我的登录活动相关的任何代码,也没有更改我的 Firebase 控制台中的设置。
private void signIn(String email, String password) {
Log.d(TAG, "signIn:" + email);
if (!validateForm()) {
return;
}
showProgressDialog();
// [START sign_in_with_email]
firebaseAuth.signInWithEmailAndPassword(email, password)
.addOnCompleteListener(this, task -> {
if (task.isSuccessful()) {
// Sign in success, update UI with the signed-in user's information
Log.d(TAG, "signInWithEmail:success");
FirebaseUser user = firebaseAuth.getCurrentUser();
updateUI(user);
} else {
// If sign in fails, display a message to the user.
Log.w(TAG, "signInWithEmail:failure", task.getException());
Toast.makeText(LoginActivity.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
}
hideProgressDialog();
});
// [END sign_in_with_email]
}
在 Logcat 中,它显示程序确实到达了登录方法,但不知何故,身份验证过程从未完成(日志从未显示 signInWithEmail:success 或 signInWithEmail:failure)。
我确实尝试了其他解决方案,例如将 addOnCompleteListener 更改为 addOnSuccessListener 但没有任何改变。Firebase 服务目前无法正常工作吗?还是我的代码有问题?我完全迷路了。我很感激你想分享的任何想法。
解决方案
推荐阅读
- css - Angular Material Pagination - 如何用文本替换第一个和最后一个图标?
- html - 如何在 Nuxtjs 应用程序中使用 Bootstrap Vue 创建特定的引导多选下拉菜单
- mysql - 为什么mysql执行sql需要多次转换字符集
- apache - 如何配置 HTTP 服务器以在 HTTP 标头中设置 REMOTE_USER?
- python - 如何序列化一个对象
- karate - 如何从 karate-config.js 检查一个 API 的状态码?
- json - JsonPath 找到包含某个字符串的所有键?
- python - 从数组中获取字典
- javascript - 调用 onHistoryCallback (nuxtJS vueJS) 时的 TradingView getBars JS API 问题
- javascript - 在 Nuxt.js 中从正文中删除填充