MauriceConrad / iCloud-API

Node API for Apple's iCloud services
1.16k stars 97 forks source link

Crash: self.account is undefined #47

Open alaq opened 4 years ago

alaq commented 4 years ago

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.

nucks commented 4 years ago

@alaq I'm having the same problem. The API no longer seems to be working because self.account is always undefined.

just4fun20 commented 4 years ago

@alaq I'm having the same problem. The API no longer seems to be working because self.account is always undefined.

nucks is there anyway to be able to talk to you personally? Thanks in advance

kopiro commented 4 years ago

https://github.com/MauriceConrad/iCloud-API/issues/49