I can see that I can save cookie manually, but I don't understand how I can use the cookie I saved.
all I'm trying to do is use cookies when I log in, any ideas?
Same problem here :(
Instead of using again the method generateDevice() from core/state, initialize and set saved client state.
const ig = new IgApiClient();
ig.state.deviceString = "saved deviceString";
ig.state.deviceId = "saved deviceId";
ig.state.uuid = "saved uuid";
ig.state.phoneId = "saved phoneId";
ig.state.adid = "saved adid";
ig.state.build = "saved build";
await ig.state.deserializeCookieJar(JSON.stringify(cookies));
Yess Man! It's work like a charm! Thank you.
@xIsra @TheFedex87
Could someone update session.example.ts with all relevant things? (serialize device data, restore everything at start)?
I am not nodejs developer and reading js code is hard for me.
Thanks in advance!
@ngortheone I created a pull request
@xlsra so if i return the saved states, does it mean i dont need to login anymore? Because i tried and it doesnt work for me. I still get "required login" error
@iamthewalkingkode use proxy sir
@iamthewalkingkode use proxy sir
When restoring session or login in ?
ok how to restore it ? for future requests
i get this message : IgLoginRequiredError: GET /api/v1/feed/user/623895092/ - 403 Forbidden; login_required
ig.state.deviceString = savedDevice.deviceString
ig.state.deviceString = savedDevice.deviceString
ig.state.deviceId = savedDevice.deviceId
ig.state.uuid = savedDevice.uuid
ig.state.phoneId = savedDevice.phoneId;
ig.state.adid = savedDevice.adid
ig.state.build = savedDevice.build
await ig.state.deserializeCookieJar(savedCookie)
let pk = await ig.user.getIdByUsername(username)
const userFeed = ig.feed.user('623895092');
const feed = await userFeed.items();
console.log(feed, 'fe')
Most helpful comment
@ngortheone I created a pull request