0

A new iOS app should be able to connect to a web service to sync data across devices. I like the way the diary app Day One solved this by offering "real" user accounts and automatically generated "anonymous" accounts:

  • On registration the user can choose to use mail address to setup a "real" account or to sign in with his Apple ID
  • When using the "real" account the mail address has to confirmed and a username and password has to be chosen
  • When using the Apple ID Sign In no additional steps are needed. The app is connected to the web services using some random user ID
  • When being installed on a new devices it is no problem to re-connect using the Apple-ID method.

Problem 1: How to access the Apple ID?

As far as I know it is not possible for the app to really to access the Apple-ID. Or is there some undocumented way to do this? How is this possible?

I suspect that the app instead might use iCloud to store some token? The iCloud storage is linked to the Apple-ID, thus when installing on a new devices it would be possible to recover the token from iCloud and use it to reconnect.

Or are there other / better methods?


Problem 2: How to handle the authentication?

Let's set Problem 1 aside and assume that we have solved the problem of creating some cross-device username. How could be handle the authentication?

  • Solution 1: Only the token (Apple ID / iCloud stored username / etc.) is used for authentication. If a request from the app to the server contains a valid username token access is granted.
  • Solution 2: In addition to the username token a random password is generated when creating the anonymous account. This could be done on the device or on the server. But since the password has to be known on both ends, it need to be transferred from one end to the other at some point.
    • 2a: Trust in the HTTPS connection and transfer the plain password
    • 2b: Use some other method (e.g. Deffie Hellman) to agree on a common password

On first sight 2b seems to be the most secure solution but is the really the case? The sync data is not encrypted but "only" trusts in the HTTPS connection. Would it add extra security to transfer the password using another method?

Additionally, does it add extra security to use a "password" at all? This is not a password the user selects for his user selected username but a automatically generated password for a automatically generated username / token.

Would it not be the same to just use the generated username token? Only who has access to the token / Apple ID / iCloud account, etc. can access the web service.


So, which solution is the best? Am I missing something and there are better solutions?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.