instagram-private-api icon indicating copy to clipboard operation
instagram-private-api copied to clipboard

400 Bad Request; challenge_required

Open ghost opened this issue 2 years ago • 17 comments

Anyone had 400 Bad Request; checkpoint_required error recently?

There is no challenge required when logged in through the official app or the web app.

code : await ig?.challenge.auto(true); logger.info(ig?.state.checkpoint);

result : { message: 'challenge_required', challenge: [Object: null prototype] { url: 'https://i.instagram.com/challenge/AXG28ykrORq5xajjsWTL_lUtgI-Eh0_-fVL9iQ8YZk8z07hhWeQOBVTOzPH_2kLVggf8xZY/AfzpNV0S4g2ZdlGo53qQCzACu7rP-nvW7G7a7LOt0UEVmjxW1MUNu2W5n5cOFtMmmKcxGysmvmBUQA/', api_path: '/challenge/AXG28ykrORq5xajjsWTL_lUtgI-Eh0_-fVL9iQ8YZk8z07hhWeQOBVTOzPH_2kLVggf8xZY/AfzpNV0S4g2ZdlGo53qQCzACu7rP-nvW7G7a7LOt0UEVmjxW1MUNu2W5n5cOFtMmmKcxGysmvmBUQA/', hide_webview_header: true, lock: true, logout: false, native_flow: true, flow_render_type: 0 }, status: 'fail', error_type: 'checkpoint_challenge_required', exception_name: 'ChallengeRequired' }

Does anyone else have the same issue?

ghost avatar Jul 25 '22 14:07 ghost

Yes, this is a frequently encountered issue when using this package.

It seems to be mainly caused by having a different IP known by Instagram for the account (the simulated device most likely has a different IP from your actual one).

Other possible causes (edge cases):

  • trying to sign in from a new location.
  • logging in too frequently.
  • logging in from a new browser.
  • signed out of Instagram in another tab.

You might want to check these out: Closed Issue with helpful replies, but no conclusive solution.

Many suggest using proxy, but according to this issue it doesn't guarantee avoiding a checkpoint/challenge_required error.

Rammina avatar Jul 26 '22 03:07 Rammina

challenge requires is basically confirming you are the account holder and requiring you to enter a 6 digit verification code. You may want to take a look at instagram-live-streamer to see how it was handled (which is exactly what I am doing right now)

lokxii avatar Jul 27 '22 10:07 lokxii

Is it due

Yes, this is a frequently encountered issue when using this package.

It seems to be mainly caused by having a different IP known by Instagram for the account (the simulated device most likely has a different IP from your actual one).

Other possible causes (edge cases):

  • trying to sign in from a new location.
  • logging in too frequently.
  • logging in from a new browser.
  • signed out of Instagram in another tab.

You might want to check these out: Closed Issue with helpful replies, but no conclusive solution.

Many suggest using proxy, but according to this issue it doesn't guarantee avoiding a checkpoint/challenge_required error.

The issue isn't about why it's happening. Earlier It was possible to bypass challenges using the library, but now it fails. I am also facing the issue.

xcrafter avatar Aug 05 '22 12:08 xcrafter

@Nerixyz is it due to the expiry of Instagram signature constant?

xcrafter avatar Aug 05 '22 12:08 xcrafter

Hello everybody,

I'm having a lot of checkpoint problems lately.

If someone has a solution to this, please email me:

My gmail is [email protected]

Did you ( @xcrafter , @Rammina , @ISLEMNEDDAR , @9tin9tin9 , @terhechte ) have this kind of problem and fix it?

TheNewAggregator avatar Aug 20 '22 00:08 TheNewAggregator

It's been coming out a lot lately. what would be the reason

murataksuu avatar Aug 21 '22 11:08 murataksuu

I am also verifying this package recently because this package is not working well.

However, this package doesn't mention much about challenges. https://api.lamadava.com/redoc#tag/s1auth

If anyone has knowledge about this please let me know.

muners avatar Aug 25 '22 06:08 muners

This problem happened to me. I activated my account on my mobile phone, was given a location and had two choices: it's me or not I confirmed that it was me and that fixed the problem

mmdzov avatar Aug 28 '22 05:08 mmdzov

@mmdzov didn't understand what you mean by it was you and how did you fixed the problem ?

ghost avatar Oct 11 '22 08:10 ghost

I solved this problem, now I make more than 100 requests without repeat authorizations. but it takes time to test for a complete solution

gradus0 avatar Dec 23 '22 14:12 gradus0

I solved this problem, now I make more than 100 requests without repeat authorizations. but it takes time to test for a complete solution

you will get it back in two weeks or more..I think your account will probably be banned/block by the end of January.

kkm avatar Dec 23 '22 21:12 kkm

I solved this problem, now I make more than 100 requests without repeat authorizations. but it takes time to test for a complete solution

you will get it back in two weeks or more..I think your account will probably be banned/block by the end of January.

you right :( You know how did fixed ?

gradus0 avatar Dec 27 '22 22:12 gradus0

I solved this problem, now I make more than 100 requests without repeat authorizations. but it takes time to test for a complete solution

you will get it back in two weeks or more..I think your account will probably be banned/block by the end of January.

Hi everyone, did anyone find a solution to this problem? I'm having it every time I need to go through the challenge

menezesbr avatar May 04 '23 20:05 menezesbr

How do you even go through the challenge? I get on my phone a warning that they detected automated use of my account, i suspect i'll get blocked if i try more

cristibaluta avatar Jul 13 '23 06:07 cristibaluta

Didn't you test on a fake account first?

lokxii avatar Jul 13 '23 08:07 lokxii

I'm also interested about this issue, I put my standalone tests (login) here without success for now.

From my point of view, for this api/project : it would be great to summarize & centralize somewhere in a dedicated readme page

  • the state of issues
  • faq about login & challenge
  • instagram behaviours related to login/login api/ip ban/..

maybe it already exists? (it seems not)

there is so much related issues (ex #1223, #1278, #1657, ...)

boly38 avatar Oct 25 '23 12:10 boly38

I got this error which mitigated after I changed the password. Also I use cookies for login which looks like this:

async function login() {
  ig.state.generateDevice(process.env.INSTAGRAM_USERNAME);
  const cookiePath = path.join(__dirname, "cookies.json");

  if (existsSync(cookiePath)) {
    const savedCookies = await readFile(cookiePath, "utf8");
    await ig.state.deserializeCookieJar(savedCookies);
  }

  try {
    await ig.account.currentUser();
  } catch (error) {
    if (error.response && error.response.statusCode === 403) {
      console.log("Logging in to Instagram...");
      await ig.account.login(
        process.env.INSTAGRAM_USERNAME,
        process.env.INSTAGRAM_PASSWORD
      );
      const cookies = await ig.state.serializeCookieJar();
      await writeFile(cookiePath, JSON.stringify(cookies));
    } else {
      console.error("Error with Instagram session:", error);
      throw error;
    }
  }
}

jungle-lord avatar Jan 02 '24 04:01 jungle-lord