mauriceconrad / icloud-api Goto Github PK
View Code? Open in Web Editor NEWNode API for Apple's iCloud services
Node API for Apple's iCloud services
Can anyone suggest how to get the X-APPLE-WEBAUTH-TOKEN cookie?
A TypeError is thrown from running your example login code
You are logged in successfully!
(node:10120) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'ckdatabasews' of undefined
at iCloud.__zone /Documents/noteconverter/node_modules/apple-icloud/resources/apps/Notes.js:178:63)
at Object.main.<computed> [as __zone] (/Documents/noteconverter/node_modules/apple-icloud/resources/helper.js:84:27)
at iCloud.fetch (/Documents/noteconverter/node_modules/apple-icloud/resources/apps/Notes.js:62:16)
at Object.main.<computed> [as fetch] (/Documents/noteconverter/node_modules/apple-icloud/resources/helper.js:84:27)
at iCloud.<anonymous> (/Documents/noteconverter/prompt-credentials.js:37:37)
at processTicksAndRejections (internal/process/task_queues.js:94:5)
(node:10120) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:10120) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
This is the code that is being run (along with prompt-credentials.js
):
const promptiCloud = require("./prompt-credentials");
(async () => {
// Login to icloud and ask for new credentials if needed
const myCloud = await promptiCloud();
// Get all notes
const notes = myCloud.Notes.fetch();
var done = false;
notes.on("data", (zone) => {
console.log(
"Fetched: " +
notes.__folders.length +
" folders; " +
notes.__notes.length +
" notes"
);
// Log folders structured
console.log(notes.folders);
});
})();
Hey there, this package is awesome, but I just have a question about Photos functionality.
I can successfully fetch photos but I only get 100 results. I've tried to dabble with the resultsLimit
and interestingly when I set it to 50
, I get back 25
results. With other numbers it always returns half of them, but it is capped at 100 results.
Is there a paging that needs to be implemented, or do you have any idea what could cause this? Thanks!
When a request to resolve a note fails on the server side (e.g. 400 Bad Request), a JSON will be returned that doesn't a "results" field.
This was the payload returned from the server from at least one of the notes in my iCloud account:
{
"uuid" : "2487d368-fc70-410d-8c0b-ec957399b58a",
"serverErrorCode" : "BAD_REQUEST",
"reason" : "BadRequestException: missing required field 'value'"
}
Therefore, this line will produce a TypeError since result.results will be undefined:
const records = result.results.map(res => res.rootRecord).map(record => {
Exception stack trace:
TypeError: Cannot read property 'map' of undefined
at Request._callback (y:\src\icloudapi-test\node_modules\apple-icloud\resources\apps\Notes.js:139:40)
at Request.self.callback (y:\src\icloudapi-test\node_modules\request\request.js:185:22)
at Request.emit (events.js:182:13)
at Request.<anonymous> (y:\src\icloudapi-test\node_modules\request\request.js:1154:10)
at Request.emit (events.js:182:13)
at IncomingMessage.<anonymous> (y:\src\icloudapi-test\node_modules\request\request.js:1076:12)
at Object.onceWrapper (events.js:275:13)
at IncomingMessage.emit (events.js:187:15)
at endReadableNT (_stream_readable.js:1091:14)
at process._tickCallback (internal/process/next_tick.js:174:19)
The reason was that at least one of my notes fetched by myCloud.Notes.fetch() had no "shortGUID" field.
Filtering out this note fixed the error for me, but there should be a general handling of Bad Request errors.
Apart from that, thanks for the great work on this project!
Hi,
Thanks for this module. However I have some issues with it.
I have the following code:
I will create an iCloud instance with session, username, password. This I store in a global var and
I use this to load every 5 minutes new findme data from the apple server using
GlobalVar.FindMe.get(username,password)
This works for 20 minutes or so, Sometimes more sometimes less and then got this error:
{ error: 'Something went wrong. Maybe your credentials are incorrect.',
code: 11 }
Then I call GlobalVar.FindMe.initialized = false; and continue. with FindMe.Get. This won't work I get the same errors.
Then I create again a new instance and store it to the globalvar and continue. Same errors. If I kill the app and restart it works.
What I am doing wrong here. Does the iCloud instance takes care of reconnecting or does the FindMe.Get this (as I also pass username and password to this as well).
Could you please help me out and describe the steps for getting the findme info on an x interval? and what I need to do when there is an error?
Thanks!
It looks like Apple quietly removed using Find My Friends from iCloud in the browser sometime September 2021. This means that the fmf
webservice is not returned by Apple.
Just letting anyone that is looking to use FMF through this project that it will not work.
If anyone is wondering if other services like FindMe still work, as of 4/27/2023 I was able to get it to list my devices.
Thanks for your work on this API! I would like to use it to play a sound on my iPhone (within the FindMe feature). Is there a way to do this currently, or do you have plans to implement it?
I'm getting an error with the getEvents method.
It's on the following var requestEventsCount = result.Event.length;
TypeError: Cannot read property 'length' of undefined
It seems that is there is no event, the Event object is undefined.
Q pls from where you got those endpoints?
Bruno
Just wondering if this is happening to anyone else. I've gotten everything working, and my scripts execute correctly without any errors.
However, every time it runs, I get a prompt on my Apple Devices (iPhone, Mac) to do 2FA, and an email indicating that a new devices has signed into iCloud. Obviously this was necessary the first time to input the code, but these subsequent requests seems to have no effect on the script running. I.e. it runs correctly regardless of what I do with the prompt, (ignore, dismiss, etc)
I believe that I am using my session JSON file correctly, otherwise I doubt I would be able to access items like Reminders and Find my Friends without having to reauthenticate. (my scripts do not have my AppleID or passwords in them, these are only in the JSON)
Any insight on what might be causing these 2FA prompts and notification emails, or is this just something with Apple that is unavoidable?
When a note that has no shortGUID field is passed to Notes.resolve(...), the iCloud will respond with a HTTP 400, the response payload of which is not handled in Notes.resolve(), leading to a follow-up error (see #51 )
Invalid data in a note should be handled before submitting the resolve request to the server.
Thanks for this great API; I would like to use App-Specific-Password - login with such a password is working - but in comparision with normal login the generated session file is not usable with the api; Any suggestions?
Not an issue as much as a question. Do you or anyone else have experience with a long-running instance of this? What I means is should I tear down my iCloud instance each time or reuse it? I am sharing session but I have a nodejs process that I am writing to be able to query it's data via voice (Alexa skill) or other UI/CLI tools.
I am planning on polling the FmF endpoints every 1-2 minutes so I can write some code to determine location of my partner and I for geo-related things ("X in on the way home", "Y remember to do Z", Turn off all lights when we both leave, etc). I can keep calling the getLocations() method but I didn't know if there was any "Session validity"/"Session expiration" checking and/or if it would refresh/renew the session if it had expired.
My guess is that it won't work and I should just re-use the session but recreate the iCloud instance to force-rechecking. That plus some system to re-enter my 2FA code remotely (maybe web endpoint with simple form that get's texted to me when it's needed? How is everyone else handling this, even for cron-type jobs this would be an issue right?).
Hey, the module on NPM is currently broken, and it looks like that the fix is your latest commit:
➜ track-apple-location diff node_modules/apple-icloud/main.js ~/Projects/iCloud-API/main.js
114,115c114,115
< console.log(self.auth.cookies.length > 0, !!self.auth.token, self.account != {}, self.username === username);
< return (self.auth.cookies.length > 0 && self.auth.token && self.account != {} && username ? (self.username === username) : true);
---
> //console.log(self.auth.cookies.length > 0, !!self.auth.token, self.account != {}, self.username === username);
> return ((self.auth.cookies.length > 0) && (self.auth.token && self.account != {}) && (username ? (self.username === username) : true));
135a136
this error comes from const images = await myCloud.Photos.get();
TypeError: Cannot read property 'zoneID' of undefined
at Request._callback (C:\Users\Home\Desktop\apple\node_modules\apple-icloud\resources\apps\Photos.js:69:41)
Hi,
when using npm install apple-icloud
version 1.1.0
is installed which has bug in self.isLogged
property - it always evaluates to true (because of username ? (self.username === username)
not put in braces), preventing login with credentials.
self.loggedIn = (function() {
//console.log(self.auth.cookies.length > 0, !!self.auth.token, self.account != {}, self.username === username);
return (self.auth.cookies.length > 0 && self.auth.token && self.account != {} && username ? (self.username === username) : true);
})();
I see it's already fixed in this repository but not in release.
BTW I've also tried using apple app-specific passwords (https://support.apple.com/en-us/HT204397) but with no luck. Do you happen to know if it's even possible?
Upon running
await myCloud.FindMe.get(username, password)
,
this error pops up
Full error:
TypeError: Cannot read properties of undefined (reading 'findme') at iCloud.__start (/Users/derrickw/VS Code Projects/Find My (Notifications)/node_modules/apple-icloud/resources/apps/FindMe.js:32:63) at Object.main.<computed> [as __start] (/Users/derrickw/VS Code Projects/Find My (Notifications)/node_modules/apple-icloud/resources/helper.js:84:27) at iCloud.__saveGet (/Users/derrickw/VS Code Projects/Find My (Notifications)/node_modules/apple-icloud/resources/apps/FindMe.js:88:19) at Object.main.<computed> [as __saveGet] (/Users/derrickw/VS Code Projects/Find My (Notifications)/node_modules/apple-icloud/resources/helper.js:84:27) at /Users/derrickw/VS Code Projects/Find My (Notifications)/node_modules/apple-icloud/resources/apps/FindMe.js:14:19 at new Promise (<anonymous>) at iCloud.get (/Users/derrickw/VS Code Projects/Find My (Notifications)/node_modules/apple-icloud/resources/apps/FindMe.js:13:26) at Object.main.<computed> [as get] (/Users/derrickw/VS Code Projects/Find My (Notifications)/node_modules/apple-icloud/resources/helper.js:84:27) at getDevices (/Users/derrickw/VS Code Projects/Find My (Notifications)/renderer.js:31:28) at processTicksAndRejections (node:internal/process/task_queues:96:5) {stack: 'TypeError: Cannot read properties of undefine…ions (node:internal/process/task_queues:96:5)', message: 'Cannot read properties of undefined (reading 'findme')'}
I can only get first 500 contacts ..
Here is my code
`
// Require the module
const iCloud = require('apple-icloud');
var session = {}; // An empty session. Has to be a session object or file path that points on a JSON file containing your session
var username = "xxx"; // Your apple id
var password = "xxxx"; // Your password
const readline = require('readline').createInterface({
input: process.stdin,
output: process.stdout
})
var myCloud = new iCloud("icloud-session.json", username, password);
myCloud.on("ready", function() {
console.log("Ready Event!");
// Check if the two-factor-authentication is required
if (myCloud.twoFactorAuthenticationIsRequired) {
// Get the security code using node-prompt
readline.question("Enter Code:", (code) => {
myCloud.securityCode = code;
readline.close()
});
}
else {
console.log("You are logged in completely!");
myCloud.Contacts.list(function(err, data) {
if (err) return console.error(err);
// Successfully your contacts :)
// console.log(data);
console.log(data.contacts.length);
});
}
});
`
Hi, thanks very much for taking the time to create this brilliant API.
I'm just wondering if the latest version of the Notes helper is committed?
I ask because the example readme talks about using the functions getFolders(), and the getFolders.js example uses uses a getAll() function. Both of which don't exist in /resources/apps/Notes.js.
As a result, the examples relating to Folders don't work and throw a type error.
They do however exist in the Mail.js resource
I'm trying to follow the samples to create an event, but unfortunately, I'm getting this:
`b/node_modules/iCloud-API/resources/helper.js:5
if (!(key in a)) {
^
TypeError: Cannot use 'in' operator to search for 'pGuid' in undefined
at Object.keys.forEach.key (/opt/varianteb/node_modules/iCloud-API/resources/helper.js:5:13)
at Array.forEach ()
at fillDefaults (/opt/varianteb/node_modules/iCloud-API/resources/helper.js:4:17)
at iCloud.createEvent (/opt/varianteb/node_modules/iCloud-API/resources/apps/Calendar.js:169:24)
at Object.main.(anonymous function) [as createEvent] (/opt/varianteb/node_modules/iCloud-API/resources/helper.js:84:27)
at iCloud. (/opt/varianteb/server/boot/routes.js:320:38)
at iCloud.emit (events.js:189:13)
at iCloud.EventEmitter.emit (domain.js:459:23)
at sessionInit (/opt/varianteb/node_modules/iCloud-API/main.js:130:14)
`
Can somebody point me to what I'm doing wrong here ?
Thanks,
Nick
Seems like some code was missed when fillDefaults was changed to be a helper
I think the problem code is lines 206-210 inf resources/apps/FindMe.js.
I will fork and create a pull request.
This was the error
TypeError: {(intermediate value)(intermediate value)}.fillDefaults is not a function
at /home/david/appleicloud/iCloud-API/resources/apps/FindMe.js:210:11
at new Promise ()
at iCloud.playSound (/home/david/appleicloud/iCloud-API/resources/apps/FindMe.js:199:12)
at Object.main. [as playSound] (/home/david/appleicloud/iCloud-API/resources/helper.js:84:27)
at /home/david/appleicloud/iCloud-API/demo/findme/playSound.js:43:38
at processTicksAndRejections (internal/process/task_queues.js:85:5)
I see that the capabilities of this api include most of the account management tasks but is it possible to create the account itself?
Code to reproduce:
// .. logged in
// list contacts
await myCloud.Contacts.list();
// attempt to create a new contact (w/ traditional promise syntax)
myCloud.Contacts.new({
firstName: 'Maurice',
lastName: 'Conrad',
emailAddresses: [
{
label: 'Private',
field: '[email protected]',
},
],
}).then(console.log).catch(console.error);
The output of the above code is as follows:
{
requestUUID: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx',
errorReason: 'Bad Request',
errorCode: 400
}
I checked the request builder in resources/apps/Contacts.js and it looks correct based on what a quick iCloud network inspector check looked like.
When using #Contacts.new to add a new contact, I will get the following error message:
"requestUUID":"4758bb9d-c842-4efc-8c66-b6e3dc2d18e4","errorReason":"Invalid sync token","errorCode":420
Per documentation, I have used #Contacts.list prior before invoking #Contacts.new like this:
cloud.Contacts.list().then(data => {
return cloud.Contacts.new(validData)
})
Assume that validData
has valid data.
I've tried to create new event to iCloud calendar by using the demo code in demo/calendar/createEvent.js
. Unfortunately, after it showed me that You are logged in successfully!
and then broken down. I noticed that iCloud server responded 400 error by output the raw response defined in resources/apps/Calendar.js
line 416. The full response is attached below:
{
"statusCode": 400,
"body": "",
"headers": {
"server": "AppleHttpServer/e70a1a237a4f",
"date": "Wed, 09 Oct 2019 14:07:51 GMT",
"content-length": "0",
"connection": "keep-alive",
"x-apple-jingle-correlation-key": "TQ3MNZ5VEVG2HOZY",
"apple-seq": "0",
"apple-tk": "false",
"apple-originating-system": "UnknownOriginatingSystem",
"x-responding-instance": "caldavj:33400801:mr22p34ic-ztbu09031801:8501:1918B268:8d279581b458",
"access-control-allow-origin": "https://www.icloud.com",
"access-control-allow-credentials": "true",
"set-cookie": [
"X-APPLE-WEBAUTH-TOKEN=\"v=2:t=IAAAAAAABLwIAAAAAF2d6bcRDmdzLycpqWCFPKlOROgyScUewbED8sW2HEpgBT-5seqgKiWM1SdpbB-..."
],
"x-apple-api-version": "v1",
"via": "xrail:mr35p00ic-qugw03170401.me.com:8301:19B224:grp21, f8995afd047f3cef862ffdc1f64276f8:Hong Kong",
"strict-transport-security": "max-age=31536000; includeSubDomains;",
"x-apple-request-uuid": "9c36c6e7-b525-4dab-a234-23e4fceeeeee",
"access-control-expose-headers": "X-Apple-Request-UUID, Via"
},
"request": {
"uri": {
"protocol": "https:",
"slashes": true,
"auth": null,
"host": "p34-calendarws.icloud.com",
"port": 443,
"hostname": "p34-calendarws.icloud.com",
"hash": null,
"search": "?clientBuildNumber=17DProject...",
"query": "clientBuildNumber=17DProject...",
"pathname": "/ca/events/home/42A6A098-CB75-A5C4-55BA-.../",
"path": "/ca/events/home/42A6A098-CB75-A5C4-55BA-.../",
"href": "https://p34-calendarws.icloud.com/ca/events/home/42A6A098-CB75-A5C4-55BA-..."
},
"method": "POST",
"headers": {
"Host": "p34-calendarws.icloud.com",
"Cookie": "X-APPLE-WEBAUTH-HSA-TRUST=\"...",
"Content-Length": 1568,
"Referer": "https://www.icloud.com/",
"Content-Type": "text/plain",
"Origin": "https://www.icloud.com",
"Accept": "*/*",
"Connection": "keep-alive",
"Accept-Language": "en-us",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/604.1.25 (KHTML, like Gecko) Version/11.0 Safari/604.1.25",
"X-Requested-With": "XMLHttpRequest"
}
}
}
Hi! I have fixed a couple things in the source code locally to get things working a bit better, but I am stuck here..
It prompts me for my 2 factor authentication, and I type in the 6 digit number. But then it says I'm logged in, but I'm not. I'm using your standard workflow.
In setup.js
there's some code...
const trusting = await this.trust(self);
// Use /trust's headers (X-Apple-Twosv-Trust-Token and new authentication token)
if ("x-apple-session-token" in trusting.response.headers) {
self.auth.token = trusting.response.headers["x-apple-session-token"];
}
if ("x-apple-twosv-trust-token" in trusting.response.headers) {
self.auth.xAppleTwosvTrustToken = trusting.response.headers["x-apple-twosv-trust-token"];
}
Well, trusting.response.headers
does not have those keys. Anyone else have these problems?
Apple introduced a new reminders app in iOS 13 and macOS Catalina. The node API doesn't seem to play nice with this new reminders data, instead returning a message saying you need to update to iOS 13 and/or Catalina. Would be great to see this issue worked on/resolved.
Getting 421 code in get_events() on catch. is this 421 or 4,2,1 i found some error code in apple dev site like 1 for case noCalendar = 1, 2 for case noStartDate = 2, 4 for case datesInverted = 4. is there any option to find why this code showing?
When I try and use your demo code to pull the reminders I'm greeted by the two reminders that Apple inserts after you upgrade the reminders backend. Is there any way to pull post upgraded to iOS 13 reminders?
Reminders returned:
Array(2) ["Where are my reminders?", "The creator of this list has upgraded these remind…"]
is this possible to do password change from api ? and if you are going to implement it?
I tried to run the demos and got this for getOpenTasks
and similar to this for getCollections
:
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'reminders' of undefined
at iCloud.getOpenTasks (......./node_modules/apple-icloud/resources/apps/Reminders.js:7:63)
at Object.main.<computed> [as getOpenTasks] (......./node_modules/apple-icloud/resources/helper.js:84:27)
I am not sure if it's because Apple's API is updated or not. If you can give me directions, I could make a pr too to contribute.
Seems like Apple will ban requests for iCloud contacts, causing a 502 error?
I get a JSON parse failure when making requests via #Contacts.list. When I print the response received, I get
<html>\r\n<head><title>502 Bad Gateway</title></head>\r\n<body>\r\n<center><h1>502 Bad Gateway</h1></center>\r\n<hr><center>Apple</center>\r\n</body>\r\n</html>\r\n"
I am able to continue using the service with another server or when I run it on my own computer.
I'm able to successfully retrieve the note I'm interested in and can see the data that's returned, but I can't figure out how to get the full content of the note as plain text. I can see a "data" field containing a object, which I am guessing is the note's content, but I haven't been able to decode it. Do you know how to do that?
{
recordName: 'd8896984-a0da-462f-bf24-8f2cf2431e75',
recordType: 'Note',
pluginFields: {},
recordChangeTag: 'b',
created: {
timestamp: 1571592174025,
userRecordName: '_cc9a65f4e232bd8c509b7ca174c9e6ec',
deviceID: '2'
},
modified: {
timestamp: 1571592924524,
userRecordName: '_cc9a65f4e232bd8c509b7ca174c9e6ec',
deviceID: '2'
},
deleted: false,
displayedHostname: 'www.icloud.com',
shortGUID: '07IwT2yxt2XNT5aXrvBI6hobg',
title: 'Test Note',
snippet: 'Hello World.',
data: <Buffer 78 9c 4d cf cd 6a c2 40 10 07 f0 dd 7c 8e a3 b5 d3 0d 7a 58 84 46 73 09 82 3d f5 a2 97 82 20 94 1e 3c 59 fa 02 e6 16 08 68 8e 3e 8e f8 30 5e 7c 88 b6 ... 178 more bytes>,
parent: {
recordName: 'DefaultFolder-CloudKit',
action: 'VALIDATE',
zoneID: {
zoneName: 'Notes',
ownerRecordName: '_cc9a65f4e232bd8c509b7ca174c9e6ec',
zoneType: 'REGULAR_CUSTOM_ZONE'
}
},
ModificationDate: 1571592921648
}
How do you find the location of a device using this API?
An idea to correct: the module for Python "PyiCloud" had the same bug and was fixed.
Hi there.
Every time I run this below:
require("dotenv").config();
let username = process.env.ICLOUD_EMAIL;
let password = process.env.ICLOUD_PWD;
module.exports = function () {
return new Promise(async (reso, reje) => {
let myCloud = await require("./prompt-credentials")();
let devices;
try {
devices = await myCloud.FindMe.get(username, password);
} catch (e) {
return reje(e);
}
const myPhone = devices.content[0];
try {
const res = await myCloud.FindMe.playSound(myPhone.id);
reso(res);
} catch (e) {
reje(e);
}
});
};
It plays the sound, but I always get a notification saying that a new sign-in is happening from my server.
Is there any way to remedy this?
Function "photos.get" returns invalid url.
It inserts the wrong photo name and passes ID
``{ __recordName: 'AUJ/gcBue4tf1P9MZ0GRzo+dHDxn',
...
original:
https://cvws.icloud-content.com/B/AUJ_gcBue4tf1P9MZ0GRzo-dHDxnAf76ZKJaJRgqwz87w9XGN5z8XL-k/AUJ/gcBue4tf1P9MZ0GRzo+dHDxn.png?o=Auo00hl3V2ID7udFn5jjZiP1cqoDvG7lAMpIyFp7h123&v=1&x=3&a=B3xvTSaXpIT6wODBLGArKgco1TGbA8fhSQEAAAOL4Uk&e=1552819567&k=_&fl=&r=50d993f5-d8b8-457d-b79c-1ab952450038-1&ckc=com.apple.photos.cloud&ckz=PrimarySync&y=1&p=46&s=x6kIYDeRjwfUEEZwQkUkUGTJ9d8 ,
meta:
{ __recordName: '063F5143-5EB2-4C98-A75C-AD10FB7C7444',
...
}
but it must be something like this:
Hi,
I'm trying to integrate your lib with an existing application (Express (Loopback)).
The rest of the application crashes with random errors like 'cannot read property 'modelName' of undefined. Do you know what it could be ?
Currently I've only:
var iCloud = require("apple-icloud");
Thanks,
Nick
When attempting to run the demo applications on Windows 10 under Cygwin where the directory to which the session file would have been written did not exist, the attempt to emit this fact failed due to "TypeError: Cannot read property 'emit' of undefined."
The problem can be solved by setting var self = this at the top of the saveSession() method in main.js and referencing that variable rather than directly referencing this.
I have been unable to create a reminder, using the example code.
I get the following stack trace:
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at Request._callback (./node_modules/apple-icloud/resources/apps/Reminders.js:110:35)
at Request.self.callback (./node_modules/request/request.js:185:22)
at Request.emit (events.js:193:13)
at Request.<anonymous> (./node_modules/request/request.js:1161:10)
at Request.emit (events.js:193:13)
at IncomingMessage.<anonymous> (./node_modules/request/request.js:1083:12)
at Object.onceWrapper (events.js:281:20)
at IncomingMessage.emit (events.js:198:15)
at endReadableNT (_stream_readable.js:1139:12)
which is because body
is an empty string here: https://github.com/MauriceConrad/iCloud-API/blob/master/resources/apps/Reminders.js#L110
I am trying to troubleshoot this (changing a task works, for instance) but any help would be appreciated, thanks!
I'm wondering if there is any way through this to get the apple health app data that is sync'd with iCloud. It shows up as using up space in my iCloud by I can't directly access the data any way that I know of, and I was wondering if there is some way you could build in a method to access it in this app.
Is there any way by which I can create/delete/reassign mail filters? Right now I can do this in iCloud Web Mail but clicking on the Settings cog (bottom left) and Rules. This allows me to filter server-side i.e. as an email arrives it automatically pushes the mail to the respective folder.
While I can get this library to work with my personal AppleID I was hoping it would also support Application Specific Passwords. Unfortunately it doesn't seem to be the case in my testing.
From an authentication perspective it shouldn't be any different - probably easier because there is no need to use a security code with an Application Specific Password. Also more portable when you don't have to deal with a security code as well.
Are there any plans for getting it to work with Application Specific Passwords?
Hello, first of all thanks for fixing #19!
Unfortunately I am now unable to run any of the examples. It seems that self.account
is always undefined.
I get the following crash scan:
(node:18246) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'reminders' of undefined
at iCloud.getOpenTasks (/home/adrien/git/roam-export/node_modules/apple-icloud/resources/apps/Reminders.js:7:63)
at Object.main.<computed> [as getOpenTasks] (/home/adrien/git/roam-export/node_modules/apple-icloud/resources/helper.js:84:27)
Here is code that triggers it, it's the example from the README:
const myCloud = new iCloud(
"icloud-session.json",
process.env.ICLOUD_LOGIN,
process.env.ICLOUD_PASSWORD
);
myCloud.on("ready", async function () {
if (myCloud.twoFactorAuthenticationIsRequired) {
prompt.get(["Security Code"], async function (err, input) {
if (err) return console.error(err);
const code = input["Security Code"];
myCloud.securityCode = code;
});
} else {
console.log("You are logged in completely!");
const collections = await myCloud.Reminders.getOpenTasks(
(err, tasks) => {
if (err) console.error(err);
else console.log(tasks);
}
);
console.log(collections);
}
});
I get the same issue with the demo examples, for any of the services.
I am not using 2FA, and it looks like I am logged in successfully because myCloud.loggedIn === true
.
Trying to fetch contacts from iCloud. On contacts.list method I am getting this error
{ reason: 'Missing X-APPLE-WEBAUTH-TOKEN cookie', error: 1 }
Kindly suggest why I am getting this error.
On inspecting auth.cookies, this contains following element
'X-APPLE-WEBAUTH-LOGIN':
'X-APPLE-WEBAUTH-VALIDATE':
'X-APPLE-WEBAUTH-HSA-LOGIN':
'X-APPLE-WEBAUTH-USER':
'X_APPLE_WEB_KB-GKJULTVXCERN2NRGJRHWFXVRFLK':
Hi, first of all thanks for the great lib!
I'm trying to add an iCalendar connection to my web app so I can read/create/update/delete events on my users' behalf.
However I can't ask them for their icloud password for security reason and for such cases apple has a feature called "application specific password" where a user can generate a password to grant access to a specific 3rd-party app (which looks like "tpke-ewiz-olyv-dfds").
When I try to use such password it gives me "Account is broken or password and username are invalid".
Maybe you could provide any input on what should be changed in the auth flow to make those credentials work? (like any specific auth url?) Can't quite find any info on that as of now so any help is much appreciated!
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.