Server to Server in iOS ?

I am developing an iOS / macOS app that will be privately distributed either directory or through B2B for iOS. Many different iOS devices will be used to store record data and ideally, those devices will NOT be signed in to iCloud. I know it is possible to read from the public database to get general app records, but in my case I need the app to WRITE to the public database.


Ideally I wish I could authenticate the iOS app with an API key, but there is no direct API for this that I know of.


I see with CloudKit server-to-server that this is possible for web apps. Would there be anything stopping me from doing a URLRequest in my iOS app with the same web-server header and requirements using the generated key? I would rather use CloudKit for this particular app than relying on Firebase and other BaaS.

Any thoughts or ideas?

Replies

Do not do this. In order to use the Server-to-Server key you have to sign the requests, which requires having your private key. If you tried to do this from devices, that means you would need to include your private key in your app and that is definitely not something you should do.

Understood! Any ideas on how to accomplish without going through another server?