Giter VIP home page Giter VIP logo

icloud.js's People

Contributors

dez64ru avatar foxt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

icloud.js's Issues

Weird - saveCredentials option not 'making it ' into index.js

Love this repo. But...I've been trying to make it work on headless linux systems without libsecret. Eventually came to the conclusion that just setting saveCredentials to false should work. It didnt! Confused I investigated and found that the javascipt index.js in the build directory is missing the check on saveCredentials. I am a total newb with typescript, so not sure if this is something i've done!!!

try { require("keytar").setPassword("https://idmsa.apple.com", this.options.username, this.options.password); } catch (e) { console.warn("[icloud] Unable to save account credentials:", e); }

The typescript has
try { if (this.options.saveCredentials) require("keytar").setPassword("https://idmsa.apple.com", this.options.username, this.options.password); } catch (e) { console.warn("[icloud] Unable to save account credentials:", e); }

iCloud Advanced Data Protection (PCS)

Currently, trying to access iCloud Drive data while having ADP enabled returns

Error: Missing PCS cookies from the request

Looking at the cookies in a web browser, it seems the X-APPLE-WEBAUTH-PCS-Sharing and X-APPLE-WEBAUTH-PCS-Documents are related

Not sure exactly what PCS stands for, possibly Private/Protected Cloud Service?

The iCloud web app sends an empty post request to https://setup.icloud.com/setup/ws/1/requestWebAccessState?clientBuildNumber=2306Hotfix38&clientMasteringNumber=2306Hotfix38&clientId=0a6768e7-9914-416d-9fd2-51b095985663&dsid=12024116479 to check if the user has consented to

ADP disabled:

{"dsid":8363351371,"isWebAccessAllowed":true}

ADP enabled:

{"dsid":12024116479,"isWebAccessAllowed":true,"isDeviceConsentedForPCS":false,"isICDRSDisabled":true,"deviceConsentForPCSExpiry":0}

(ICDRS possibly meaning iCloud Data Recovery Service)

If PCS consent is not granted, iCloud website sends a POST request to https://setup.icloud.com/setup/ws/1/enableDeviceConsentForPCS?clientBuildNumber=2306Hotfix38&clientMasteringNumber=2306Hotfix38&clientId=0a6768e7-9914-416d-9fd2-51b095985663&dsid=12024116479 (with no body), to which the following response is sent

{"isDeviceConsentNotificationSent":true,"isWebAccessAllowed":true,"isDeviceConsentedForPCS":false,"isICDRSDisabled":true,"deviceConsentForPCSExpiry":0}

and a notification is sent to the users iPhone.

The URL https://setup.icloud.com/setup/ws/1/requestWebAccessState?clientBuildNumber=2306Hotfix38&clientMasteringNumber=2306Hotfix38&clientId=0a6768e7-9914-416d-9fd2-51b095985663&dsid=12024116479 is polled with an empty POST.

No consent yet:

{"dsid":12024116479,"isWebAccessAllowed":true,"isDeviceConsentedForPCS":false,"isICDRSDisabled":true,"deviceConsentForPCSExpiry":0}

Consent granted:

{"dsid":12024116479,"isWebAccessAllowed":true,"isDeviceConsentedForPCS":true,"isICDRSDisabled":true,"deviceConsentForPCSExpiry":1674401748101}

The expiry period seems to be 1 hour

When accessing an ADP service, iCloud website, if it knows PCS consent is granted, sends a POST request to
https://setup.icloud.com/setup/ws/1/requestPCS?clientBuildNumber=2306Hotfix38&clientMasteringNumber=2306Hotfix38&clientId=4c1e9a0b-7cba-4c27-a9e3-c6f020fd416e&dsid=12024116479 with {"appName":"iclouddrive","derivedFromUserAction":true} to ensure that PCS cookies are present.

If PCS cookies sent with the request are not valid, but consent is already provided, the following is sent as JSON along with the cookies required

{"isWebAccessAllowed":true,"isDeviceConsentedForPCS":true,"isICDRSDisabled":true,"message":"Cookies attached.","deviceConsentForPCSExpiry":1674400678814,"status":"success"}

If PCS cookies sent with the request is valid, the following is sent

{"isWebAccessAllowed":true,"isDeviceConsentedForPCS":true,"isICDRSDisabled":true,"message":"Cookies already present.","deviceConsentForPCSExpiry":1674400678814,"status":"success"}

Findmy service constructor calls findmy refresh

Should this be happening? Documentation and example suggests that refresh is called separately. Also refresh is async?

I have only seen this as when I was investigating the reauthentication thing, I found I was seeing extra refreshes

Status code 400 on set 2fa code

Hello, this library still WIP?
I always get error when i set security code

const iCloud = require('icloudjs').default
const path = require('path')
const prompt = require('prompt')

const icloud = new iCloud({
    username: "my_apple_id",
    password: "my_password",
    saveCredentials: true,
    trustDevice: true,
    dataDirectory: path.resolve('./tmp/')
});

(async() => {
  await icloud.authenticate()

  if (icloud.status === "MfaRequested") {
    const code =  await prompt.get(['2fa code'])
    await icloud.provideMfaCode(code)
  }

  await icloud.awaitReady;
  console.log("Hello, " + icloud.accountInfo.dsInfo.fullName)
})();
error

Screenshot 2022-11-18 at 01 16 27

PS: also tried enter code without any space

Offer MFA Code Resend / Send via SMS function

It would be helpful to offer functions that allow to resend the MFA code or send it via different means like the iCloud login does.

I see at least two functions, but there might be more:

  1. Resend Code in case it was not received

  2. Send code via SMS
    On the iCloud login page this triggers a PUT request to https://idmsa.apple.com/appleauth/auth/verify/phone with body

{
    "mode": "sms",
    "phoneNumber": { 
        "id": 1
    }
}

I would trigger the call myself but it requires a bunch of headers that should be available in the iCloud instance this library creates.

Calling Refresh on "findme" service > 5 mins after connect causes 'invalid json body' error

I'm probably doing something wrong -:(

I connect successfully, get the findme service, call refresh and all works

I can continue to get the service and call refresh for a few minutes (4-5), however then I get the 'Invalid Json response body' and have to reconnect.

After investigation, it seems that the fetch for the refresh is return an http code of 450 and an empty body.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.