[英]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.