Accessing iCloud Calendar API from a NodeJS server

200 Views Asked by At

I am trying to build an app (JavaScript) to confirm the appointments of a doctor automatically by reading the iCloud Calendar events from a specific day and then confirming such appointments.

I have been searching the internet for a week now, and have not been able to find a way to do iCloud Authentication to access the calendar info using a link, like this one: https://pxxx-calendarws.icloud.com/ca/events?clientBuildNumber=xxx&clientId=xxx&clientMasteringNumber=xxx&clientVersion=xxx&dsid=xxx&lang=en-us&requestID=6&usertz=xxx.

To get info from this link I need to have some auth cookies like an X-APPLE-WEBAUTH-TOKEN or X-APPLE-WEBAUTH-USER (but there are a lot more).

I am sure it is possible to do so because I found a website called Calendly that allows users to sync their iCloud Calendar, and after giving access not only can they read events from the calendar but can also create and update events on iCloud from Calendly (which is similar to what we need to do).

What I have done so far:

  1. I have gotten the necessary cookies by logging in a web browser with iCloud and inspecting the network calls, but some cookies expire with the session so this method only works for a short period of time.
  2. I opened an apple developer account, created an app id, a secret key, and other stuff there to see if I could find a way to get the cookies by using an authentication token, but I don't really understand the connection between the token and the cookies, or how to get from one to the other. Here are some docs that I have read:
  1. I have looked for an iCloud API open for JavaScript use but had no luck. I found this resource https://github.com/MauriceConrad/iCloud-API/tree/master but it is an unofficial development, and it scares me that Apple could block my account in the future.
  2. I created an app specific password in Apple ID, to be able to authenticate myself in apps like Calendly without sharing my iCloud password. But I don't really know how to use this credentials to get to the auth cookies.
  3. I found related answers in forums, where they cite apple endpoints such as https://setup.icloud.com/setup/ws/1/login or found this one https://setup.icloud.com/setup/ws/1/accountLogin, but I have had no luck with finding documentation for this APIs (maybe I am not searching right):

Does any one have any resource or code where you can access iCloud Calendar events using an official iCloud API using node? I don't think that what I am trying to do is crazy or so hard, it is just that I find the Apple docs really confusing.

Please help! I would really appreciate it.

0

There are 0 best solutions below