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 in IgCheckpointError #1699

Open menezesbr opened 1 year ago

menezesbr commented 1 year ago

Bug Report

Form

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

Requirements

Description

I'm having the error below when we try to login to an instagram account and it needs to go through the ig.challenge.auto(true) function. Apparently some information is missing in the POST, but I can't find documentation anywhere saying what should be sent

Code

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

      if (err instanceof IgCheckpointError) {
        await ig.challenge.auto(true)  //    <-------------- ERROR Here

        return {
          type: 'checkpoint',
        }
      } else if (err instanceof IgLoginTwoFactorRequiredError) {
        const { username, totp_two_factor_on, two_factor_identifier, obfuscated_phone_number, sms_two_factor_on } =
          err.response.body.two_factor_info

        return {
          username,
          totp: totp_two_factor_on,
          sms: sms_two_factor_on,
          phone: obfuscated_phone_number,
          two_factor_identifier,
          type: '2FA',
        }
      }

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

400 Bad Request; challenge_required - instagram-private-api/dist/repositories/challenge.repository.js:61:13)
ERROR: POST /api/v1/challenge/reset/AXFMzVXfPZm8Tv2x_g7YT1e1CH4BMtT0x_oSasLmIGtZLmZh9_eiSWYGQd2UatXBTYSR/AfxjU7WgXn6sTlIYhRp6-jq35JA_XRFNsOT4OdkXPn5cV2a5tq9k46QhP_dhPhHIlxShmI5mn6HO_g/ - 400 Bad Request; challenge_required err: { "type": "IgCheckpointError", "message": "POST /api/v1/challenge/reset/AXFMzVXfPZm8Tv2x_g7YT1e1CH4BMtT0x_oSasLmIGtZLmZh9_eiSWYGQd2UatXBTYSR/AfxjU7WgXn6sTlIYhRp6-jq35JA_XRFNsOT4OdkXPn5cV2a5tq9k46QhP_dhPhHIlxShmI5mn6HO_g/ - 400 Bad Request; challenge_required", "stack": IgCheckpointError: POST /api/v1/challenge/reset/AXFMzVXfPZm8Tv2x_g7YT1e1CH4BMtT0x_oSasLmIGtZLmZh9_eiSWYGQd2UatXBTYSR/AfxjU7WgXn6sTlIYhRp6-jq35JA_XRFNsOT4OdkXPn5cV2a5tq9k46QhP_dhPhHIlxShmI5mn6HO_g/ - 400 Bad Request; challenge_required at Request.handleResponseError (/opt/gosac/app/backend/node_modules/instagram-private-api/dist/core/request.js:108:24) at Request.send (/opt/gosac/app/backend/node_modules/instagram-private-api/dist/core/request.js:54:28) at async ChallengeRepository.reset (/opt/gosac/app/backend/node_modules/instagram-private-api/dist/repositories/challenge.repository.js:80:26) at async ChallengeRepository.auto (/opt/gosac/app/backend/node_modules/instagram-private-api/dist/repositories/challenge.repository.js:61:13) }
boly38 commented 1 year ago

seems to be a duplicate of #1657