dilame / instagram-private-api

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

400 Bad Request; challenge_required #1637

Open ghost opened 2 years ago

ghost commented 2 years ago

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/AXG28ykrORq5xajjsWTLlUtgI-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?

Rammina commented 2 years ago

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):

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.

lokxii commented 2 years ago

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)

xcrafter commented 2 years ago

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 commented 2 years ago

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

TheNewAggregator commented 2 years ago

Hello everybody,

I'm having a lot of checkpoint problems lately.

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

My gmail is danielpaixaodp2021@gmail.com

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

murataksuu commented 2 years ago

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

muners commented 2 years ago

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.

mmdzov commented 2 years ago

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

ghost commented 2 years ago

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

gradus0 commented 1 year ago

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

kkm commented 1 year ago

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.

gradus0 commented 1 year ago

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 ?

menezesbr commented 1 year ago

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

cristibaluta commented 1 year ago

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

lokxii commented 1 year ago

Didn't you test on a fake account first?

boly38 commented 1 year ago

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

maybe it already exists? (it seems not)

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

jungle-lord commented 10 months ago

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;
    }
  }
}