dilame / instagram-private-api

NodeJS Instagram private API SDK. Written in TypeScript.
MIT License
5.97k stars 1.14k forks source link

simulate.preLoginflow() causing 506 (invalid private/public key) error #1354

Open yblok13 opened 3 years ago

yblok13 commented 3 years ago

Bug Report

Form

Requirements

Description

During await ig.simulate.preLoginFlow() I get hit with 506 (invalid public/private key) when requesting these endpoints: POST /api/v1/launcher/sync/ POST /api/v1/qe/sync/

After a few failed attempts, I get 429 (timeout) on those requests, which is obvious.

Code

(async () => {
    const ig = new IgApiClient();
    ig.state.generateDevice(process.env.username);
    try {
        await ig.simulate.preLoginFlow();
        const user = await ig.account.login(process.env.username, process.env.password);
        process.nextTick(async () => await ig.simulate.postLoginFlow())
        console.log(user)
    } catch (e) {
        console.error(e)
    }
})()

Error and Output

Error

IgResponseError: POST /api/v1/launcher/sync/ - 560 -; 
    at Request.handleResponseError (/home/ubuntu/cluster/dev/node_modules/instagram-private-api/dist/core/request.js:125:16)
    at Request.send (/home/ubuntu/cluster/dev/node_modules/instagram-private-api/dist/core/request.js:53:28)
    at async LauncherRepository.sync (/home/ubuntu/cluster/dev/node_modules/instagram-private-api/dist/repositories/launcher.repository.js:22:26)

Debug

ig:request Requesting POST /api/v1/accounts/read_msisdn_header/
ig:state Could not find ds_user_id
ig:request Requesting POST /api/v1/qe/sync/
ig:request Requesting POST /api/v1/accounts/get_prefill_candidates/
ig:request Requesting POST /api/v1/attribution/log_attribution/
ig:request Requesting POST /api/v1/accounts/msisdn_header_bootstrap/
ig:request Requesting GET /api/v1/zr/token/result/
ig:request Requesting POST /api/v1/launcher/sync/
ig:request Request POST /api/v1/launcher/sync/ failed: 
yblok13 commented 3 years ago

Downgraded nodejs from v14.15.4 to v14.6.0 and I got past the issue.