我阅读了苹果公司提供的示例(CloudKit目录),发现每次写入或读取数据时都需要将API token放入脚本中。
现在Javascript是客户端基础,这意味着每个用户都可以读取API token并读写我的容器?!
这段代码将会在一个Javascript文件中。
CloudKit.configure({
locale: 'en-us',
containers: [{
// Change this to a container identifier you own.
containerIdentifier: 'com.example.apple-samplecode.cloudkit-catalog',
apiTokenAuth: {
// And generate a web token through CloudKit Dashboard.
apiToken: '<insert your token here>',
persist: true, // Sets a cookie.
signInButton: {
id: 'apple-sign-in-button',
theme: 'black' // Other options: 'white', 'white-with-outline'.
},
signOutButton: {
id: 'apple-sign-out-button',
theme: 'black'
}
},
environment: 'development'
}]
});
现在的问题是:我是否遗漏了什么或者解决方案是使用Node进行服务器到服务器通信?
nodeJS
服务器。这意味着Javascript不是客户端的。 - Pogrindis