简体   繁体   English

Firebase 电子邮件/密码身份验证从未完成

[英]Firebase email/password authentication never completed

I implement email/password sign-in method provided by Firebase in my Android apps.我在我的 Android 应用程序中实现了 Firebase 提供的电子邮件/密码登录方法。 It was working fine.它工作正常。 But today it didn't work for some reasons unknown to me.但是今天由于某些我不知道的原因它不起作用。 I didn't change any codes related to my login activity and didn't change the settings in my Firebase console.我没有更改与我的登录活动相关的任何代码,也没有更改 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]
}

In the Logcat, it showed that the program did reach the sign in method, but somehow the authentication process never completed (the log never shows signInWithEmail:success or signInWithEmail:failure).在 Logcat 中,它显示程序确实到达了登录方法,但不知何故身份验证过程从未完成(日志从未显示 signInWithEmail:success 或 signInWithEmail:failure)。

在此处输入图片说明

I did try other solution such as changing addOnCompleteListener to addOnSuccessListener but nothing changed.我确实尝试了其他解决方案,例如将 addOnCompleteListener 更改为 addOnSuccessListener 但没有任何改变。 Is Firebase service currently not working? Firebase 服务目前无法正常工作吗? Or is there something wrong with my codes?还是我的代码有问题? I'm completely at lost.我完全迷失了。 I appreciate any thoughts you'd like to share.我很感激你想分享的任何想法。

I managed to make it work again by creating a new emulator with x86_64 SDK .我设法通过使用 x86_64 SDK创建一个新的模拟器使其再次工作。 I think it's related with this question and this question我认为这与这个问题这个问题有关

Did you logout ?你退出了吗? Try to logout first and then it will sign in.尝试先注销,然后它会登录。

Try doing firebaseAuth.signOut() in your onCreate method.尝试在您的 onCreate 方法中执行firebaseAuth.signOut() It might help.它可能会有所帮助。

但此日志指的是方法 (SignIn) 而不是 firebaseAuth 方法,请从 Tools->Firebase -> Authentication -> Connect to Firebase(如果未连接)检查您与 Firebase 的连接

I had another task FirebaseAuth.getInstance().currentUser.getIdToken(true).我有另一个任务 FirebaseAuth.getInstance().currentUser.getIdToken(true)。 It never completed because I called it from the main thread.它从未完成,因为我从主线程调用它。 When I called from the background thread - it completed.当我从后台线程调用时 - 它完成了。

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

相关问题 使用电子邮件和密码进行 Firebase 身份验证 - Firebase Authentication With Email & Password Firebase 电子邮件和密码身份验证失败 - Firebase email and password authentication fails 如何绑定Email的手机和Firebase的密码认证? - How to link Phone with Email and Password Authentication in Firebase? Firebase身份验证API电子邮件/密码Android - Firebase Authentication API Email/Password Android Android Firebase 电子邮件和密码身份验证不起作用 - Android Firebase Email and password authentication does not work Android-Firebase身份验证不适用于电子邮件/密码设置 - Android - Firebase Authentication not working with Email/Password setup 如何将 Firebase 电话身份验证与电子邮件/密码身份验证联系起来? - How Can I Link Firebase Phone Authentication with Email/Password Authentication? “ AUTHENTICATION DISABLED”,使用Firebase离子电子邮件/密码身份验证时出错 - “AUTHENTICATION DISABLED”, error using Firebase Ionic Email/Password Authentication 使用Firebase身份验证通过电子邮件/密码将Firebase连接到Android应用程序 - Connecting Firebase to Android application using Firebase authentication via email/password 我无法使用 Firebase 身份验证使用电子邮件和密码登录 - I can't login with Email & Password using Firebase Authentication
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM