Android 上的 Flutter Firebase 电话身份验证错误

Ufu*_*man 0 android firebase firebase-authentication flutter

我想使用 Firebase Auth 验证电话号码,但出现以下错误,

注意:我的 sha1 和 sha256 密钥已附加。当我手动将电话号码添加到 firebase 时,它​​会起作用。在 iOS 设备上运行流畅。

[GetAuthDomainTask] 获取项目配置时出错。

{
"error":{
  "code":400,
  "message":"INVALID_CERT_HASH",
  "errors":[
     {
        "message":"INVALID_CERT_HASH",
        "domain":"global",
        "reason":"invalid"
     }
  ]
}
}
Run Code Online (Sandbox Code Playgroud)

输出 :

I/chatty  (10469): uid=10134(com.xxx.xxx) identical 1 line
W/xxx.xxx(10469): Accessing hidden method Lsun/misc/Unsafe;- 
>putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
W/System  (10469): Ignoring header X-Firebase-Locale because its value 
was null.
D/EGL_emulation(10469): eglMakeCurrent: 0x7a08b7442b80: ver 3 0 (tinfo 
0x7a08b7299680)
E/FirebaseAuth(10469): [GetAuthDomainTask] Error getting project 
config. Failed with {
E/FirebaseAuth(10469):   "error": {
E/FirebaseAuth(10469):     "code": 400,
E/FirebaseAuth(10469):     "message": "INVALID_CERT_HASH",
E/FirebaseAuth(10469):     "errors": [
E/FirebaseAuth(10469):       {
E/FirebaseAuth(10469):         "message": "INVALID_CERT_HASH",
E/FirebaseAuth(10469):         "domain": "global",
E/FirebaseAuth(10469):         "reason": "invalid"
E/FirebaseAuth(10469):       }
E/FirebaseAuth(10469):     ]
E/FirebaseAuth(10469):   }
E/FirebaseAuth(10469): }
E/FirebaseAuth(10469):  400
E/zzf     (10469): Failed to get reCAPTCHA token - calling backend 
without app verification
D/EGL_emulation(10469): eglMakeCurrent: 0x7a08b7442b80: ver 3 0 (tinfo 
0x7a08b7299680)
W/System  (10469): Ignoring header X-Firebase-Locale because its value 
was null.
E/FirebaseAuth(10469): [SmsRetrieverHelper] SMS verification code 
request failed: unknown status code: 17093 null
I/flutter (10469): exception
I/flutter (10469): [firebase_auth/missing-client-identifier] This 
request is missing a valid app identifier, meaning that neither 
SafetyNet checks nor reCAPTCHA checks succeeded. Please try again, or 
check the logcat for more details.
W/GoogleApiManager(10469): com.google.android.gms.internal.auth-api- 
phone.zzv could not execute call because it requires feature 
(sms_retrieve, 1).
W/GoogleApiAvailability(10469): GMS core API Availability. 
ConnectionResult=2, tag=null
W/GoogleApiAvailability(10469): java.lang.IllegalArgumentException
Run Code Online (Sandbox Code Playgroud)

gre*_*boy 9

我有同样的错误,因为我通过 vscode 终端生成了我的 sha1 证书,如果你想要电话认证,这很糟糕。所以我修复了

  1. 通过android studio打开我的android文件夹
  2. 点击 .android/app/build.gradle
  3. 选择android studio左侧的gradle view
  4. 选择 android>task>signReport
  5. 等待一段时间,你会得到真正的sha!证书
  6. 有复制和过去的 firebase 项目。

如果这些不起作用然后检查

  1. 如果您从 firebase auth 启用了电话身份验证
  2. 然后启用android deviceCheck Api