foxt / icloud.js

Library for accessing iCloud in Node.js

Home Page:https://npmjs.com/icloudjs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

davidcreager opened this issue · comments

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.

commented

see also: picklepete/pyicloud#372
looks like we need to reauthenticate?

Ok....that was a useful link/hint

I tried reauthenticating and then refreshing again when the refresh gets a return of 450. (I don't think I'm familiar enough with your design to presume to make a pull request)

It didn't quite work, although the next refresh did

I think you are missing an await when you call getiCloudCookies on line 88 in index.js, authenticate function.

I added await and all now seems good!!

Let me know if you want me to send any info or test.

This is by far the cleanest javascript icloud api I have come across Thanks for sharing your work. I am very hopeful it will satisfy my needs!!!