dilame / instagram-private-api

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

Login problem : 400 Bad Request #1457

Open shadowgroundz opened 3 years ago

shadowgroundz commented 3 years ago

Form

Requirements

Description

Hi, I've issue.I failed to login and never happend before. When I debug logs tell "Please wait a few minutes before you try again". But I retry after +6 hours

Code


async function login(username, password) {
  ig.state.generateDevice(username);
  await ig.simulate.preLoginFlow();
  spinner.start({ text: 'Media found...' });
  const loginProcess = await ig.account
    .login(username, password)
    .catch((err) => {
      console.log('ERROR : ', err);
    });
  if (loginProcess.pk) {
    spinner.succeed('Logged');
  }
  return loginProcess;
}

const loginStatus = await login(usernameIg, passwordIg);

Error and Output

ig:request Requesting POST /api/v1/accounts/msisdn_header_bootstrap/ +0ms
ig:request Requesting GET /api/v1/zr/token/result/ +468ms
ig:request Requesting POST /api/v1/accounts/get_prefill_candidates/ +428ms
ig:request Request POST /api/v1/accounts/get_prefill_candidates/ failed: {"message":"Please wait a few minutes before you try again.","status":"fail"} +407ms
ig:state Could not find ds_user_id +0ms
ig:request Requesting POST /api/v1/qe/sync/ +5ms
ig:request Requesting POST /api/v1/accounts/contact_point_prefill/ +462ms
ig:request Request POST /api/v1/accounts/contact_point_prefill/ failed: {"message":"Please wait a few minutes before you try again.","status":"fail"} +459ms
ig:request Requesting POST /api/v1/attribution/log_attribution/ +5ms
ig:request Request POST /api/v1/attribution/log_attribution/ failed: {"message":"error logging attribution","status":"fail"} +557ms
IgResponseError: POST /api/v1/attribution/log_attribution/ - 400 Bad Request; error logging attribution
    at Request.handleResponseError (/Users/vinzlee/Documents/Node/Uploader/node_modules/instagram-private-api/dist/core/request.js:125:16)
    at Request.send (/Users/vinzlee/Documents/Node/Uploader/node_modules/instagram-private-api/dist/core/request.js:53:28)
    at async AttributionRepository.logAttribution (/Users/vinzlee/Documents/Node/Uploader/node_modules/instagram-private-api/dist/repositories/attribution.repository.js:6:26)
phibersoft commented 3 years ago

I removed this line and code working now

await ig.simulate.preLoginFlow();

yblok13 commented 3 years ago

Had the same issue out of no where starting yesterday. I still think the pre login Flow is needed. Going to just remove the request to log attribution from the pre login flow service.

shadowgroundz commented 3 years ago

I removed this line and code working now

await ig.simulate.preLoginFlow();

Thank you. It work perfectly again. But I never change this code and everything run okay before

ccmoralesj commented 3 years ago

I had this same issue, by removing the preLoginFlow() function works like a charm

melodyjs commented 3 years ago

I've tried login process without preLoginFlow() and run several accounts to test.

It looked everything works fine but few days later, we've found that some accounts are blocked by Instagram for 1~2 days which is never happened before.

So in my opinion, If you don't want to take the risk, I suggest not removing preLoginFlow() until the problem is fixed.

hailovigor commented 3 years ago

I've tried login process without preLoginFlow() and run several accounts to test.

It looked everything works fine but few days later, we've found that some accounts are blocked by Instagram for 1~2 days which is never happened before.

So in my opinion, If you don't want to take the risk, I suggest not removing preLoginFlow() until the problem is fixed.

My accounts were blocked forever. Without preLoginFlow(), it gave an error and replaced it with ig.qe.syncLoginExperiments(). But I don't know what these experiments are)) It began to work.

shadowgroundz commented 3 years ago

Wow. Thanks for letting me know.

On Wed, Jun 30, 2021, 4:53 PM Hailov Igor @.***> wrote:

I've tried login process without preLoginFlow() and run several accounts to test.

It looked everything works fine but few days later, we've found that some accounts are blocked by Instagram for 1~2 days which is never happened before.

So in my opinion, If you don't want to take the risk, I suggest not removing preLoginFlow() until the problem is fixed.

My accounts were blocked forever. Without preLoginFlow(), it gave an error and replaced it with ig.qe.syncLoginExperiments(). But I don't know what these experiments are)) It began to work.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dilame/instagram-private-api/issues/1457#issuecomment-871260149, or unsubscribe https://github.com/notifications/unsubscribe-auth/AECYH2BP2PARRKOC6HY5YADTVLSTNANCNFSM47LMV6MA .

1312rahulshah commented 3 years ago

not working even after removing preLoginFlow()

kingbotss commented 2 years ago

https://github.com/kingbotss/igportable