Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Anonymously Log In to an App with iCloud Apple ID

According to this CloudKit overview:

CloudKit also enables your users to anonymously sign in to your apps with their iCloud Apple IDs without sharing their personal information.

I can't find anything else in their documentation about this capability. I already have an app with my own backend, so I wouldn't need any of the back-end-as-a-service features that CloudKit offers, but I would like to take advantage of logging a user in with their iCloud account, much the same way we currently do with Facebook and Twitter.

Is that possible with CloudKit, or do you also have to leverage their BAAS features in order to take advantage of login?

like image 962
djibouti33 Avatar asked Jun 27 '14 18:06

djibouti33


People also ask

Can someone see my apps if they have my Apple ID?

Helpful answers. yes if someone knows the apple id password they can log in and see all your notes, reminders. they can download your apps you have paid for and get them for free.

Does Apple tell you when someone logs into your iCloud?

If someone has my Apple ID and logs into it, will Apple notice me? The short answer is: Yes! Since 2017, Apple has added security and they will notify you via email if your Apple ID is logged in on a new device. If the login is unauthorized by you, you can remove that device from your Apple ID in iCloud.

Can you be traced with your Apple ID?

No. Apple will NOT help. Apple can NOT track the location of the device. The only way to track it is with Find My iPhone, which YOU must have set up with YOUR iCloud account on the device prior to deciding you need / want to track it.

Can you log into someone else's Apple ID to download apps?

When you change the Apple ID that you use for Family Sharing, your family members can't access or download purchases from your previous account. They also can't use any DRM-protected music, movies, TV shows, books, apps, or in-app purchases that they previously downloaded from that account.


2 Answers

From what they discussed at WWDC, you'd do this using the fetchUserRecordIDWithCompletionHandler: method on CKContainer. That returns a CKRecordID that corresponds to the current user. This ID will be stable across devices but different for each app-- so if the same person uses your app on multiple devices, your app will get the same result everywhere, but other apps would get different results from yours.

Once you have the CKRecordID you can look up limited other user data (their name and email, I think) using fetchRecordWithID:completionHandler:. This request will trigger a permission alert to the user, so you only get it if they allow it.

This doesn't require you to use anything else in CloudKit. It does require that the user actually have an iCloud account configured on the device.

like image 156
Tom Harrington Avatar answered Sep 24 '22 03:09

Tom Harrington


The permission alert will only pop if you call -[CKContainer requestApplicationPermission:CKApplicationPermissionUserDiscoverability...].

If the user grants permission (CKApplicationPermissionStatusGranted) then you can get the user's first and last name by running a CKDiscoverUserInfosOperation.

Requesting discoverability means that you can see the user's first and last name, and that any other user of the container can find their user record ID via an email address or look up their first and last name via a user record ID.

like image 26
farktronix Avatar answered Sep 23 '22 03:09

farktronix