Instagram-private-api: IgResponseError: POST /api/v1/accounts/login/ - 400 Bad Request

Created on 7 Jul 2019  路  19Comments  路  Source: dilame/instagram-private-api

Right after login it IG returns the following response:

{ message: '', two_factor_required: true, two_factor_info: { username: 'lyxsus', sms_two_factor_on: true, totp_two_factor_on: false, obfuscated_phone_number: '3469', two_factor_identifier: 'WrLhM8Bsqb', show_messenger_code_option: false, show_new_login_screen: true, show_trusted_device_option: false, phone_verification_settings: { max_sms_count: 2, resend_sms_delay_sec: 60, robocall_count_down_time_sec: 30, robocall_after_max_sms: true } }, phone_verification_settings: { max_sms_count: 2, resend_sms_delay_sec: 60, robocall_count_down_time_sec: 30, robocall_after_max_sms: true }, status: 'fail' }

And I get SMS code notification right after that. Happens on multiple accounts, multiple proxies, VPN and nots. It works only when I get a code via email.

Most helpful comment

Still not working for me, You should check again for me.
Several times(more than 30 times using 3 account) I had been tried to implement the features but not available, In fact, I did something about Direct message and commenting using this API in 4 dyas ago.

Actually I am very familiar with 0.10.6 before building the api using typescript.
At that time, I had seen this kinds of issues on Instagram, but that was worked if I click the button "It was me".

All 19 comments

turn off two-factor authentication

Is there any solution how to enter this code and add session to cache, that we no need to login every time?

I'm working on a pr, where you can just set trustThisDevice to true

@Nerixyz, Im interested in getting 2FA to work... I saw your PR #835, but can't seem to get 2FA to work (or checkpoints at all: Error: No checkpoint data available). Can you provide an example for your implementation?

js await Bluebird.try(() => ig.account.login(process.env.IG_USERNAME, process.env.IG_PASSWORD)).catch(IgLoginTwoFactorRequiredError, (err) => { return ig.account.twoFactorLogin({ twoFactorIdentifier: err.response.body.two_factor_info.two_factor_identifier, verificationMethod: '1', trustThisDevice: '1', username: process.env.IG_USERNAME, verificationCode: '000000', }); });
This should work

Yes! Tyvm, this works like a charm (and got checkpoints working too now)

This issue and #740 can probably be closed now.

No it doesn't work correctly!

image

No it doesn't work correctly!

This isn't related to two-factor-auth.
You have a challenge to resolve. Although it doesn't work always, try using ig.challenge.auto(true).

image

This code already worked in serveral days ago, but currently it is not available to access the Instagram.

You need to call it after you login, so the instance can access the state data.

Sorry Nerixyz, It's terrible to access the state as well, actually, I had spend much time on this module to create my own bot before, currently instagram had been changed something to access his api.
If you can, please check the this module.
image

It isn't executed. Try putting it in a catch block like

login(...).catch(e =>{ console.log('challenge');
ig.challenge.auto(true);
});

image

image

Still not working for me, You should check again for me.
Several times(more than 30 times using 3 account) I had been tried to implement the features but not available, In fact, I did something about Direct message and commenting using this API in 4 dyas ago.

Actually I am very familiar with 0.10.6 before building the api using typescript.
At that time, I had seen this kinds of issues on Instagram, but that was worked if I click the button "It was me".

i meet same mistaken, can't how to fix

import 'dotenv/config';
import { IgApiClient,} from '../src';
// import * as Bluebird from 'bluebird';
// tslint:disable-next-line:no-var-requires
const shttps = require('socks-proxy-agent'); // you should install SOCKS5 client via: npm i socks-proxy-agent
(async () => {
const ig = new IgApiClient();
// ig.challenge.auto(true);
ig.state.generateDevice(process.env.IG_USERNAME);
ig.request.defaults.agentClass = shttps; // apply agent class to request library defaults
ig.request.defaults.agentOptions = {
// @ts-ignore
hostname: '127.0.0.1', // proxy hostname
port: 3080, // proxy port
protocol: 'socks:' // supported: 'socks:' , 'socks4:' , 'socks4a:' , 'socks5:' , 'socks5h:'
};

const auth = await ig.account.login(
process.env.IG_USERNAME,
process.env.IG_PASSWORD).catch(
async e => {
console.error(e);
await ig.challenge.auto(true) });

console.log(auth);
// Do your things.

})();

when i use ts-node xx.ts, i got there mistaken:

IgResponseError: POST /api/v1/accounts/login/ - 400 Bad Request;
at Request.handleResponseError (D:\DemoProject\VUE\instagram_api\instagram-private-apisrc\core\request.ts:138:12)
at Request.send (D:\DemoProject\VUE\instagram_api\instagram-private-apisrc\core\request.ts:77:24)
(node:9256) UnhandledPromiseRejectionWarning: IgNoCheckpointError: No checkpoint data available
at ChallengeRepository.auto (D:\DemoProject\VUE\instagram_api\instagram-private-apisrc\repositories\challenge.repository.ts:82:13)
at ig.account.login.catch (D:\DemoProject\VUE\instagram_api\instagram-private-apiexamples\socks5-proxy.example.ts:24:62)
(node:9256) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async func
tion without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:9256) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handl
ed will terminate the Node.js process with a non-zero exit code.

https://github.com/dilame/instagram-private-api/blob/master/examples/checkpoint.example.ts
Try to use the login catch of the example above, I resolved using it @panamacheng

I'm getting the same error but just with
Capture d鈥檈虂cran 2019-12-21 a虁 10 43 48
I don't know what I can do... And my login activities on instagram.com there's nothing so I don't think it's a challenge problem

Fixed by downgrading instagram_mqtt

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zalkanorr picture zalkanorr  路  12Comments

ambross picture ambross  路  10Comments

sagardalal21 picture sagardalal21  路  39Comments

nikitaulshin picture nikitaulshin  路  17Comments

350d picture 350d  路  53Comments