After reviewing the example provided by Apple in the CloudKit catalog, I noticed that every time you want to write or read data, you must include your API token in the script.
Since Javascript is client-based, does this mean that any user can access and manipulate my containers by reading the API token?
The code snippet below would be included in one of the Javascript files:
CloudKit.configure({
locale: 'en-us',
containers: [{
// Update container identifier with your own.
containerIdentifier: 'com.example.apple-samplecode.cloudkit-catalog',
apiTokenAuth: {
// 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'
}]
});
So, the question remains: am I overlooking something, or is the solution to implement server-to-server communication using Node.js?