Instagram-private-api: challenge_required Stuck/Looping (it was me) SOLVED

Created on 3 Jul 2020  路  4Comments  路  Source: dilame/instagram-private-api

Form

Put an [x] if you meet the condition, else leave [ ].

Question

Why i'm stuck in looping challenge_required ?
i always click it was me Button. but after login again stuck in challenge_required again.

How to auto click It Was Me or to Solve this challenge?

Code

A meaningful section of your code (else delete this). If you are using TypeScript replace js with typescript.

const { IgApiClient, IgCheckpointError } = require('instagram-private-api');
const Bluebird = require('bluebird');
const inquirer = require('inquirer');

/**
 * This method won't catch all checkpoint errors
 * There's currently a new checkpoint used by instagram which requires 'web-support'
 */

(async () => {
  const ig = new IgApiClient();
  ig.state.generateDevice('user');
  Bluebird.try(async () => {
    const auth = await ig.account.login('user', 'pw');
    console.log(auth);
  }).catch(IgCheckpointError, async () => {
    console.log(ig.state.checkpoint); // Checkpoint info here
    await ig.challenge.auto(true); // Requesting sms-code or click "It was me" button
    console.log(ig.state.checkpoint); // Challenge info here
    const { code } = await inquirer.prompt([
      {
        type: 'input',
        name: 'code',
        message: 'Enter code',
      },
    ]);
    console.log(await ig.challenge.sendSecurityCode(code));
  }).catch(e => console.log('Could not resolve checkpoint:', e, e.stack));
})();

Error and Output

{
  message: 'challenge_required',
  challenge: {
    url: 'https://i.instagram.com/challenge/7536877086/C5B3T4qlLZ/',
    api_path: '/challenge/7536877086/C5B3T4qlLZ/',
    hide_webview_header: true,
    lock: true,
    logout: false,
    native_flow: true
  },
  status: 'fail',
  error_type: 'checkpoint_challenge_required'
}
question unconfirmed

Most helpful comment

@tomopan

maybe you can test this

that code you can get from Email or SMS

const { IgApiClient, IgCheckpointError } = require('instagram-private-api');
const Bluebird = require('bluebird');
const inquirer = require('inquirer');

/**
 * This method won't catch all checkpoint errors
 * There's currently a new checkpoint used by instagram which requires 'web-support'
 */
const IG_USER = '';
const IG_PW = '';

(async () => {
  const ig = new IgApiClient();
  ig.state.generateDevice(IG_USER);
  Bluebird.try(async () => {
    const auth = await ig.account.login(IG_USER, IG_PW);
    console.log(auth);
  }).catch(IgCheckpointError, async () => {
    console.log(ig.state.checkpoint); // Checkpoint info here
    await ig.challenge.selectVerifyMethod(1, false); //1. Email 0. SMS  send code OTP
    console.log(ig.state.checkpoint); // Challenge info here
    console.log(chalk.green('[+++] Check OTP Email'))
    const { code } = await inquirer.prompt([
      {
        type: 'input',
        name: 'code',
        message: 'Enter code',
      },
    ]);
    console.log(await ig.challenge.sendSecurityCode(code));
  }).catch(e => console.log('Could not resolve checkpoint:', e, e.stack));
})();

All 4 comments

Well i found a solution lol.

This is the step

  1. Verif Your Email/OTP SMS
  2. Logout ALL account in Login Activity (or you can Change PW to logout all) then check the login activity and click logout
  3. And then run your bot
  4. Check OTP (If You Verif BOTH you will received SMS else if You verif Email ONLY you will received OTP in your Email)
  5. Paste code in bot

Good Luck!

also change the

  ig.state.generateDevice(...);

@areltiyan

Where does it need to be pasted?

  1. Paste code in bot

@tomopan

maybe you can test this

that code you can get from Email or SMS

const { IgApiClient, IgCheckpointError } = require('instagram-private-api');
const Bluebird = require('bluebird');
const inquirer = require('inquirer');

/**
 * This method won't catch all checkpoint errors
 * There's currently a new checkpoint used by instagram which requires 'web-support'
 */
const IG_USER = '';
const IG_PW = '';

(async () => {
  const ig = new IgApiClient();
  ig.state.generateDevice(IG_USER);
  Bluebird.try(async () => {
    const auth = await ig.account.login(IG_USER, IG_PW);
    console.log(auth);
  }).catch(IgCheckpointError, async () => {
    console.log(ig.state.checkpoint); // Checkpoint info here
    await ig.challenge.selectVerifyMethod(1, false); //1. Email 0. SMS  send code OTP
    console.log(ig.state.checkpoint); // Challenge info here
    console.log(chalk.green('[+++] Check OTP Email'))
    const { code } = await inquirer.prompt([
      {
        type: 'input',
        name: 'code',
        message: 'Enter code',
      },
    ]);
    console.log(await ig.challenge.sendSecurityCode(code));
  }).catch(e => console.log('Could not resolve checkpoint:', e, e.stack));
})();
Was this page helpful?
0 / 5 - 0 ratings

Related issues

27RU57 picture 27RU57  路  12Comments

MMrR0b0TT picture MMrR0b0TT  路  18Comments

ozican picture ozican  路  143Comments

delmotte picture delmotte  路  61Comments

ciolt picture ciolt  路  35Comments