我最近迁移到了新版本的 Firebase。我在我的 iOS 应用程序中使用新的 SDK。
我使用的是 Firebase 3.2.0,并且在使用自定义 token 登录时遇到以下错误:
Optional(Error Domain=FIRAuthErrorDomain Code=17999 "An internal error has occurred, print and inspect the error details for more information." UserInfo={NSUnderlyingError=0x7fd290f3dc50 {Error Domain=FIRAuthInternalErrorDomain Code=3 "(null)" UserInfo={FIRAuthErrorUserInfoDeserializedResponseKey=<CFBasicHash 0x7fd2931787a0 [0x10e5db7b0]>{type = immutable dict, count = 3,
entries =>
0 : <CFString 0x7fd2931669b0 [0x10e5db7b0]>{contents = "message"} = <CFString 0x7fd29318e280 [0x10e5db7b0]>{contents = "MISSING_IDENTIFIER"}
1 : errors = <CFArray 0x7fd2931554b0 [0x10e5db7b0]>{type = immutable, count = 1, values = (
0 : <CFBasicHash 0x7fd293141000 [0x10e5db7b0]>{type = immutable dict, count = 3,
entries =>
0 : reason = invalid
1 : message = <CFString 0x7fd2931a0070 [0x10e5db7b0]>{contents = "MISSING_IDENTIFIER"}
2 : domain = global
}
)}
2 : code = <CFNumber 0xb000000000001903 [0x10e5db7b0]>{value = +400, type = kCFNumberSInt64Type}
}
}}, error_name=ERROR_INTERNAL_ERROR, NSLocalizedDescription=An internal error has occurred, print and inspect the error details for more information.})
我不知道“MISSING_IDENTIFIER”是什么意思。
有人有同样的问题吗?
最佳答案
我解决了这个问题。 当服务器生成自定义 token 时,“uid”的值是必需的。 “IDENTIFIER”表示值“uid”。
$payload = array(
"iss" => $service_account_email,
"sub" => $service_account_email,
"aud" => "https://identitytoolkit.googleapis.com/google.identity.identitytoolkit.v1.IdentityToolkit",
"iat" => $now_seconds,
"exp" => $now_seconds+(60*60), // Maximum expiration time is one hour
"uid" => $uid,
"claims" => array(
"premium_account" => $is_premium_account
);
关于ios - Firebase 和 iOS : FIRAuthInternalErrorDomain "MISSING_IDENTIFIER" when trying to login with custom token,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37590143/