IgLoginBadPasswordError when password is actually right
Author: pfortiniCreated Feb 14, 2025Updated May 7, 2026
Labelsbugunconfirmed
Form
Requirements
- I've searched the Issues
- I've read the basic concepts
- I'm using the latest version
- I've debugged my code using the
DEBUGvariable.
Platform
- I'm using Node.js version
v20.18.0 - I'm using electron
Description
When trying to do the authentication flow, as shown in the examples, I'm getting an error saying:
IgLoginBadPasswordError: POST /api/v1/accounts/login/ - 400 Bad Request; You can log in with your linked Facebook account.
But if I try it via browser, using the exact same credentials, the login is successful.
Code
import { IgApiClient } from 'instagram-private-api';
async function test() {
// commenting the credentials for this
const username = '...';
const password = '...';
const ig = new IgApiClient();
ig.state.generateDevice(username);
await ig.simulate.preLoginFlow();
await ig.account.login(username, password);
await ig.simulate.postLoginFlow();
}
test();Error and Output
Error
IgLoginBadPasswordError: POST /api/v1/accounts/login/ - 400 Bad Request; You can log in with your linked Facebook account.
at /home/fortini/repos/CE-Monitor/node_modules/instagram-private-api/dist/repositories/account.repository.js:40:27
at tryCatcher (/home/fortini/repos/CE-Monitor/node_modules/bluebird/js/release/util.js:16:23)
at /home/fortini/repos/CE-Monitor/node_modules/bluebird/js/release/catch_filter.js:17:41
at tryCatcher (/home/fortini/repos/CE-Monitor/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/home/fortini/repos/CE-Monitor/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/home/fortini/repos/CE-Monitor/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/home/fortini/repos/CE-Monitor/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/home/fortini/repos/CE-Monitor/node_modules/bluebird/js/release/promise.js:725:18)
at _drainQueueStep (/home/fortini/repos/CE-Monitor/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/home/fortini/repos/CE-Monitor/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/home/fortini/repos/CE-Monitor/node_modules/bluebird/js/release/async.js:102:5)
at Async.drainQueues [as _onImmediate] (/home/fortini/repos/CE-Monitor/node_modules/bluebird/js/release/async.js:15:14)
at process.processImmediate (node:internal/timers:483:21)Output
ig:request Requesting POST /api/v1/accounts/msisdn_header_bootstrap/ +0ms
ig:state Could not find csrftoken +0ms
ig:state csrftoken lookup failed, returning "missing". +0ms
ig:request Requesting POST /api/v1/accounts/contact_point_prefill/ +246ms
ig:request Requesting POST /api/v1/accounts/read_msisdn_header/ +211ms
ig:request Requesting GET /api/v1/zr/token/result/ +218ms
ig:request Requesting POST /api/v1/launcher/sync/ +197ms
ig:request Requesting POST /api/v1/attribution/log_attribution/ +204ms
ig:request Requesting POST /api/v1/accounts/get_prefill_candidates/ +200ms
ig:state Could not find csrftoken +1s
ig:state csrftoken lookup failed, returning "missing". +0ms
ig:request Requesting POST /api/v1/accounts/login/ +230ms
ig:request Request POST /api/v1/accounts/login/ failed: {"message":"You can log in with your linked Facebook account.","status":"fail","error_title":"Forgotten password","buttons":[{"title":"Use Facebook","action":"login_with_facebook"},{"title":"Try Again","action":"dismiss"}],"is_cp_nonce_flow":false,"login_identifer_type":"email","login_user_input":"...","qe_device_id":"a1c6b03e-09f2-5cfa-b085-10b7b3f70dcd","login_attempt_count":1,"login_source":"unknown","error_code":1,"invalid_credentials":true,"exception_name":"UserInvalidCredentials","error_type":"bad_password"} +6sSource: dilame/instagram-private-api