dilame / instagram-private-api

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

Cannot generateDevice with custom seed #1362

Open andresespinosapc opened 3 years ago

andresespinosapc commented 3 years ago

Bug Report

Form

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

Requirements

Description

If I use generateDevice with the username as a seed, I can login successfully. But if use another seed I get IgLoginBadPasswordError. I know it doesn't make any sense 😞, but I tried to simplify my code the most and it keeps happening. I even tried running the session.example.ts code directly, only changing the generateDevice's seed.

Code

This is the only code I have aside from defining username and password variables.

const ig = new IgApiClient();
try {
  ig.state.generateDevice('test');
  await ig.account.login(username, password);
  console.log('login with test seed successful');
} catch (e) {
  console.log('error with test seed:', e);
}
try {
  ig.state.generateDevice(username);
  await ig.account.login(username, password);
  console.log('login with username seed successful');
} catch (e) {
  console.log('error with username seed:', e);
}

Error and Output

With the code above, I first get:

error with test seed: IgLoginBadPasswordError: POST /api/v1/accounts/login/ - 400 Bad Request; The password you entered is incorrect. Please try again.
    at /home/andres/workspace/salesHack/services/ig_chatbot/node_modules/instagram-private-api/dist/repositories/account.repository.js:40:27
    at tryCatcher (/home/andres/workspace/salesHack/services/ig_chatbot/node_modules/bluebird/js/release/util.js:16:23)
    at /home/andres/workspace/salesHack/services/ig_chatbot/node_modules/bluebird/js/release/catch_filter.js:17:41
    at bound (domain.js:430:14)
    at runBound (domain.js:443:12)
    at tryCatcher (/home/andres/workspace/salesHack/services/ig_chatbot/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/andres/workspace/salesHack/services/ig_chatbot/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/home/andres/workspace/salesHack/services/ig_chatbot/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/home/andres/workspace/salesHack/services/ig_chatbot/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/home/andres/workspace/salesHack/services/ig_chatbot/node_modules/bluebird/js/release/promise.js:725:18)
    at _drainQueueStep (/home/andres/workspace/salesHack/services/ig_chatbot/node_modules/bluebird/js/release/async.js:93:12)
    at _drainQueue (/home/andres/workspace/salesHack/services/ig_chatbot/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/home/andres/workspace/salesHack/services/ig_chatbot/node_modules/bluebird/js/release/async.js:102:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/home/andres/workspace/salesHack/services/ig_chatbot/node_modules/bluebird/js/release/async.js:15:14)
    at processImmediate (internal/timers.js:461:21)
    at process.topLevelDomainCallback (domain.js:138:15)
    at process.callbackTrampoline (internal/async_hooks.js:127:14)

Then I get:

login with username seed successful
yblok13 commented 3 years ago

I wouldn't use the seed 'test'. I had issues with a similar "easy" seed.