question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Login problem : 400 Bad Request

See original GitHub issue

Form

Requirements

  • I’ve searched the Issues
  • I’ve read the basic concepts
  • I’m using the latest version
  • I’ve debugged my code using the DEBUG variable.

Platform

  • I’m using Node.js version YOUR_VERSION (node -v)
  • I’m using electron
  • I’m using the browser YOUR_BROWSER_AND_VERSION
  • I’m using some other environment YOUR_ENV

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)

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:10

github_iconTop GitHub Comments

5reactions
phibersoftcommented, Jun 26, 2021

I removed this line and code working now

await ig.simulate.preLoginFlow();

2reactions
shadowgroundzcommented, Jun 30, 2021

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 .

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix a 400 Bad Request Error (Causes and Fixes) - Kinsta
The 400 (Bad Request) status code indicates that the server cannot or will not process the request due to something that is perceived...
Read more >
How to Fix a 400 Bad Request Error: 8 Easy Methods
The 400 bad request error is an HTTP status code that describes an error caused by an invalid request. Thus, the server can't...
Read more >
What is a 400 Bad Request Error (and How Can I Fix It)?
A 400 Bad Request Error occurs when a request sent to the website server is incorrect or corrupt, and the server receiving the...
Read more >
How to Fix the 400 Bad Request Error - Lifewire
The 400 Bad Request error means that the request you sent to the website server to view the page was somehow incorrect.
Read more >
HTTP Error 400 Bad Request: What It Is and How to Fix It
The HyperText Transfer Protocol (HTTP) 400 Bad Request response status code indicates that the server cannot or will not process the request due...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found