dilame / instagram-private-api

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

When challenged, use ig.challenge.auto(true), but no email is receive #1691

Closed RDKclick closed 1 year ago

RDKclick commented 1 year ago

Bug Report

Read the Notes and fill out the form.

Notes

Your issue will be closed if you violate any rule below.

Form

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

Requirements

Description

A specific description of your bug, so it's understandable to anyone. If you have pictures or videos to upload, please add a link like this: [title](url).

YOUR DESCRIPTION HERE

Code

Add a meaningful section of your code here. If you are using TypeScript replace js with typescript.

ig.account.login(USER_NAME, PASS_WORD)
  .then(async auth => {
    console.log('success', USER_NAME);
  })
  .catch(async error => {
    if (
      error.response &&
      error.response.body &&
      error.response.body.error_type
    ) {
      // error_type
      //  1. checkpoint_challenge_required 
      //  2. ip_block
      let error_type = error.response.body.error_type;
      switch (error_type) {
        case 'checkpoint_challenge_required':
          await ig.challenge.auto(true); // Requesting sms-code or click "It was me" button

          break;
        case 'ip_block':
      }

      return error.response.body;
    }

    return error;
  });

Error and Output

If you've got an error put it here. You can get the stacktrace in the most environments using Error.stack (MDN Docs).

YOUR WELL FORMATTED ERROR
YOUR OUTPUT GOES HERE
RDKclick commented 1 year ago

This is return { message: 'challenge_required', challenge: [Object: null prototype] { url: 'https://i.instagram.com/challenge/AXHLbU89VoUfcLxPne0_UVi6FqCEzRFnkw4hrsVa5CmVJNYspFy_8SawrrAfUQjSmyuKsz8/Afwpw_aaj8VvqsNGNjt8NDOcP_5hCglLw7T_ler6ttH_UYCVgwepu9-7_yy4uMUp7JuhcJGKtzmn5w/', api_path: '/challenge/AXHLbU89VoUfcLxPne0_UVi6FqCEzRFnkw4hrsVa5CmVJNYspFy_8SawrrAfUQjSmyuKsz8/Afwpw_aaj8VvqsNGNjt8NDOcP_5hCglLw7T_ler6ttH_UYCVgwepu9-7_yy4uMUp7JuhcJGKtzmn5w/', hide_webview_header: true, lock: true, logout: false, native_flow: true, flow_render_type: 0 }, status: 'fail', error_type: 'checkpoint_challenge_required' }