简体   繁体   English

Firebase 电子邮件和密码身份验证失败

[英]Firebase email and password authentication fails

Firebase email and password authentication fails even though I have it activated in the Firebase console and the code for that activity is from the github sample.即使我在 Firebase 控制台中激活了 Firebase 电子邮件和密码身份验证,并且该活动的代码来自 github 示例,但它仍然失败。

Also I have added a user manually so everything is there.我还手动添加了一个用户,所以一切都在那里。

I am doing as in this link describes: Firebase instructions我正在按照此链接中的描述进行操作: Firebase 说明

Update更新

Here is the code for the signing in method:这是登录方法的代码:

mAuth.signInWithEmailAndPassword(email, password)
     .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
        @Override
        public void onComplete(@NonNull Task<AuthResult> task) {
          Log.d(TAG, "signInWithEmail:onComplete:" + task.isSuccessful());

          // If sign in fails, display a message to the user. If sign in succeeds
          // the auth state listener will be notified and logic to handle the
          // signed in user can be handled in the listener.
          if (!task.isSuccessful()) {
            Log.w(TAG, "signInWithEmail", task.getException());
            Toast.makeText(EmailPasswordActivity.this, "Authentication failed.",
            Toast.LENGTH_SHORT).show();
          }

          // [START_EXCLUDE]
          hideProgressDialog();
          // [END_EXCLUDE]
        }
      });

Update 2更新 2

I have also tried to do this and I does not work either:我也尝试过这样做,但我也不工作:

private void signInBeta(String email,String password){
  Firebase ref = new Firebase("https://prechecker-46a58.firebaseio.com/");

  ref.authWithPassword(String.valueOf(email), String.valueOf(password), new Firebase.AuthResultHandler() {
    @Override
    public void onAuthenticated(AuthData authData) {
      System.out.println("User ID: " + authData.getUid() + ", Provider: " + authData.getProvider());
    }

    @Override
    public void onAuthenticationError(FirebaseError firebaseError) {
      System.out.print("\nSOMETING WENT WRONG\n");
    }
  });
}

This could be because you haven't enable oAuth for login. 这可能是因为您尚未启用oAuth进行登录。
Try adding OAuth Client ID in https://console.developers.google.com/apis/credentials ? 尝试在https://console.developers.google.com/apis/credentials中添加OAuth客户端ID吗?

Firebase does not accept if the email id is not in the format of email id and it does not accept password with shorter length. 如果电子邮件ID的格式不是电子邮件ID,则Firebase不接受,并且不接受长度较短的密码。 My Problem is also the same, but the solution might seems sense less to you. 我的问题也相同,但是对您来说解决方案似乎意义不大。 I hope this may helps you. 希望对您有帮助。 While giving email and password make sure that email id has '@domain.com' for example 'leoXXXX@gmail.com' and your password must atleast has length of 10. 在提供电子邮件和密码时,请确保电子邮件ID为“ @ domain.com”,例如“ leoXXXX@gmail.com”,并且您的密码长度至少为10。

如果您使用虚拟设备运行应用程序,请检查Google服务是否为最新版本,或切换到包含所有更新的个人设备。

If you are using an emulator please use the latest device, because older than Pixel XL devices won't work, You will get an error message as: "Authentication failed."如果您使用的是模拟器,请使用最新的设备,因为比 Pixel XL 更旧的设备将无法工作,您将收到一条错误消息:“身份验证失败。” including Pixel XL.包括 Pixel XL。

我花了整整一天的时间来弄清楚,事实证明您需要密码长度为6+

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

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