[英]Flutter Firebase Phone Authentication error on Android
我想用 Firebase Auth 验证电话号码,但它给出了以下错误,
注意:我的 sha1 和 sha256 密钥已附上。 当我手动将电话号码添加到 firebase 时,它可以工作。 在 iOS 设备上运行顺畅。
[GetAuthDomainTask] 获取项目配置时出错。
{
"error":{
"code":400,
"message":"INVALID_CERT_HASH",
"errors":[
{
"message":"INVALID_CERT_HASH",
"domain":"global",
"reason":"invalid"
}
]
}
}
output:
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
我有同样的错误,因为我通过 vscode 终端生成了我的 sha1 证书,如果你想要电话身份验证,这很糟糕。 所以我修复了
.android/app/build.gradle
android>task>signReport
如果这些不起作用,请检查
将以下依赖项添加到您的 build.gradle 文件中
实现 'androidx.browser:browser:1.3.0'
@Ufuk Zimmerman 可以通过android>task>signReport
为您创建证书以进行调试,但是当您创建签名的.apk
时,您需要使用密钥库(.jks)文件,并且您需要通过我认为的相同密钥库创建 SHA使用命令获取 SHA 的最佳方式。
keytool -list -v -keystore {keystore_name_with_complete_path} -alias {alias_name}
例子
keytool -list -v -keystore C:\Users\name\Desktop\test.jks -alias test
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.