【问题标题】:Firebase Authentication Returning 400Firebase 身份验证返回 400
【发布时间】:2018-11-27 21:15:33
【问题描述】:

我正在尝试熟悉适用于 Android 应用的 Firebase。出于测试目的,我只是使用一个空白活动来尝试在应用程序启动时创建用户,我在 OSX 上的 android 模拟器中启动该应用程序。

活动就是这样:

public class MainActivity extends Activity {
  @Override
  protected void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    FirebaseAuth mAuth = FirebaseAuth.getInstance();
    mAuth.createUserWithEmailAndPassword("name@gmail.com", "random_string");
    setContentView(R.layout.main);
  }
}

这似乎在模拟器中启动得很好,但我的 Firebase 用户仪表板显示没有任何变化。我已启用用户注册的电子邮件和密码流程。

唯一的提示是:

2018-11-27 16:03:43.930 18564-18829/? E/Volley: [1569] BasicNetwork.performRequest: Unexpected response code 400 for https://www.googleapis.com/identitytoolkit/v3/relyingparty/signupNewUser?alt=proto&key=key_string_was_here

我在 Firebase 端看不到任何日志记录信息,所以我真的不确定出了什么问题。有人对从哪里开始挖掘有任何建议吗?

【问题讨论】:

  • 谢谢。我认为控制台已经改变,因为链接不再是一种选择。此外,当我在 firebase 中设置项目时,我必须提供 SHA1 指纹。这些是我在设置时遵循的说明:developers.google.com/android/guides/client-auth
  • 呃。我很笨。我没有在电子邮件字符串中包含“.com”。日志中有一条关于此的消息,但它被标记为严重性信息而不是错误,所以我一直错过它。

标签: android firebase firebase-authentication


【解决方案1】:

在身份验证选项卡下的 Firebase 控制台中启用您在应用中使用的身份验证类型(电子邮件和密码、电话号码..)

【讨论】:

    【解决方案2】:

    我处于开发阶段。当我以另一个用户身份登录时尝试注册新用户时,我遇到了同样的错误。

    试试吧

    signOut();
    

    注册前确认。或者更好 - 重新设计应用程序,禁止登录用户使用。

    【讨论】:

      【解决方案3】:
      After uploading app to Play Console, you'll get Signing Keys:
      Follow:
      Goto Play Console: Select App -> Menu -> Release Dashboard ->  App Signing
      and copy App Signing SHA-1 
      and goto 
      Firebase  -> Project Settings and Search for Add Figerprint:
      Add fingerprint: then paste the key there. That's it
      
      Note: Remember to remove SHA-1 from key else it will spit error fingerprint format not matching and make sure you have enabled authetication from firebase.
      

      它会 100% 工作

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-12-25
        • 2020-10-15
        • 2020-06-04
        • 2023-04-03
        • 1970-01-01
        • 2018-10-30
        • 2018-01-19
        • 2021-09-27
        相关资源
        最近更新 更多