ios - Firebase 和 iOS : FIRAuthInternalErrorDomain "MISSING_IDENTIFIER" when trying to login with custom token

标签 ios swift firebase firebase-authentication

我最近迁移到了新版本的 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”。

Generate Custom Token

$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/

相关文章:

ios - 如何在应用程序委托(delegate)文件中的整个应用程序中设置自定义导航 Controller 后退箭头图像?

ios - 帐户自动从 Xcode 中删除

ios - Swift 2 - PDF 文档分页

swift - 正确释放嵌入在 subview 中的 NSViewController

Android::如何在 token 过期时自动重新验证用户(电子邮件+密码验证)

swift - Firebase - 从低到高排序子值

ios - 如何根据按下的按钮更改 UITableView 中 Label 的文本?

ios - iOS 中带有托管对象的 Thread 中的错误访问错误

ios - 加载特定 View

node.js - Firebase数据库如何防止并发读取?