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.

400 Bad Request; Login Error...

See original GitHub issue

Platform

  • [x ] I’m using Node.js version 14

Description

When I want to login, I got this error. How can I fix that

Code

const client = new IgApiClient();

    const username = 'username';
    const password = 'password';

    client.state.generateDevice(username)

    try {
        const loggedInAccount = await client.account.login(username, password);
        await client.simulate.postLoginFlow();

        const cu = await client.account.currentUser();

        console.log({
            'prfile': cu,
        })
    } catch (e) {
        console.log(e)
    }

Error and Output

{
  error: IgResponseError: POST /api/v1/qp/batch_fetch/ - 400 Bad Request; FAILURE
      at Request.handleResponseError (C:\Users\Administrator\Desktop\node_ig\instagram-private-api\dist\core\request.js:125:16)
      at Request.send (C:\Users\Administrator\Desktop\node_ig\instagram-private-api\dist\core\request.js:53:28)
}

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:9

github_iconTop GitHub Comments

1reaction
razzy777commented, Nov 5, 2021

await client.simulate.postLoginFlow(); Removing this line worked for me and won’t have any other effects.

0reactions
kingbotsscommented, Mar 15, 2022

You should send request as http2 instead of http. For me this is working

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 >
400 Bad Request Error: What It Is and How to Fix It
The 400 Bad Request Error is an HTTP response status code indicating that the server was unable to process the request sent by...
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