【发布时间】:2017-07-12 00:46:48
【问题描述】:
RealmSwift 2.8.3、Realm 对象服务器 1.8.1、Xcode 8、Swift 3.1
我可以使用 Realm Object Server (ROS) 获得几乎所有内容来使用 iCloud 身份验证,但是当我有一个新用户身份验证时我遇到了一个问题,该用户在我的 ROS 实例上还没有帐户.
我成功地检索了他们的 iCloud 令牌,但当我这样做时,user 是 nil:
let credentials = SyncCredentials.cloudKit(token: token)
SyncUser.logIn(with: credentials, server: serverURL) { user, error in
DispatchQueue.main.async{
if user == nil {
//--- Error ---
//This is where I end up. I can see the token in the log but no user object
}else{
//--- Success ---
}
}
}
当我检查我的 ROS(在 Ubuntu 上运行)中的错误日志时,我收到了这个内部服务器错误 (500):
2017-07-12T00:39:39.170Z - warn: auth.cloudkit: Handle request failed with: Error: Request failed with code AUTHENTICATION_FAILED: Authentication failed.
2017-07-12T00:39:39.174Z - warn: [services] internal error: Error: Request failed with code AUTHENTICATION_FAILED: Authentication failed.
at request.catch.err (/usr/lib/nodejs/realm-object-server-developer/.build/src/node/managers/auth/provider/cloudkit.js:131:23)
at process._tickCallback (internal/process/next_tick.js:109:7).
现在只是为了确保,我假设SyncCredentials.cloudKit(token: token) 创建一个用户如果在我的服务器上找不到该令牌并返回一个新的用户对象。我在文档中没有看到任何关于创建新用户与验证现有用户的内容。
更新
我仔细检查了我与 iCloud 的所有连接,确保在我的 configuration.yml 文件中找到的 key_id 是正确的,并且我的密钥与我在 iCloud 容器中的密钥匹配。
现在我得到一个不同的错误。 :)
2017-07-12T01:12:54.801Z - warn: auth.cloudkit: Handle request failed with: TypeError: Cannot read property 'reason' of undefined
2017-07-12T01:12:54.809Z - warn: [services] internal error: TypeError: Cannot read property 'reason' of undefined
at signedRequest.then.catch.err (/usr/lib/nodejs/realm-object-server-developer/.build/src/node/managers/auth/provider/cloudkit.js:86:11)
at process._tickCallback (internal/process/next_tick.js:109:7).
【问题讨论】:
-
如果您在 Realm Object Server 中看到
internal errors,我建议您提交错误报告以及在此处重现的详细步骤:github.com/realm/realm-mobile-platform/issues/new -
@jpsim 我提交了一个,但因为我找到了(不相关的)解决方案,所以已经关闭了它。随时重新打开并寻求更清晰的错误消息:github.com/realm/realm-mobile-platform/issues/237
-
你是如何获得 icloud 令牌的?
-
@AdamSmaka 像这样:d.pr/n/O8rdQx+
标签: realm realm-mobile-platform