instagram-web-api icon indicating copy to clipboard operation
instagram-web-api copied to clipboard

UnhandledPromiseRejectionWarning: StatusCodeError: 403 - "{\"message\":\"login_required\",\"status\":\"fail\"}"

Open Deivesilvaka opened this issue 4 years ago • 6 comments

(node:16500) UnhandledPromiseRejectionWarning: StatusCodeError: 403 - "{"message":"login_required","status":"fail"}" at new StatusCodeError (C:\Users\luidavidas\Desktop\Case - Instagram\node_modules\request-promise-core\lib\errors.js:32:15) at Request.plumbing.callback (C:\Users\luidavidas\Desktop\Case - Instagram\node_modules\request-promise-core\lib\plumbing.js:104:33) at Request.RP$callback [as _callback] (C:\Users\luidavidas\Desktop\Case - Instagram\node_modules\request-promise-core\lib\plumbing.js:46:31) at Request.self.callback (C:\Users\luidavidas\Desktop\Case - Instagram\node_modules\request\request.js:185:22) at Request.emit (events.js:400:28) at Request. (C:\Users\luidavidas\Desktop\Case - Instagram\node_modules\request\request.js:1154:10) at Request.emit (events.js:400:28) at IncomingMessage. (C:\Users\luidavidas\Desktop\Case - Instagram\node_modules\request\request.js:1076:12)
at Object.onceWrapper (events.js:519:28) at IncomingMessage.emit (events.js:412:35) (Use node --trace-warnings ... to show where the warning was created) (node:16500) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:16500) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Deivesilvaka avatar Aug 26 '21 18:08 Deivesilvaka

I've already logged in, but this error still gives.

Deivesilvaka avatar Aug 26 '21 18:08 Deivesilvaka

Same

yogipw avatar Sep 02 '21 08:09 yogipw

Try this for authentication

index.js

const Instagram = require('instagram-web-api')
const dotenv = require('dotenv');
dotenv.config({ path: './process.env' });
const username = process.env.IGUSERNAME
const password = process.env.IGPASSWORD
 
const IGclient = new Instagram({ username, password })
 
IGclient
  .login()
  .then(() => {
    IGclient
      .getProfile()
      .then(console.log)
  })

put this to process.env in your directory:

IGUSERNAME=YOURINSTAGRAMUSERNAME
IGPASSWORD=YOURINSTAGRAMPASSWORD

it will return your instagram data.

RasmonT avatar Sep 13 '21 16:09 RasmonT

Same issue, I trued getting profile and it returns me an undefined value in the console.

Sirius3615 avatar Oct 08 '21 10:10 Sirius3615

Figured it out, I forgot I changed Instagram username and didn't update it in my .env file. 😝

Sirius3615 avatar Oct 08 '21 10:10 Sirius3615

same also for me or better it work for some time and after 10/15 times I got the error 403. If I wait some hours/days it works again

fulviocesile avatar Oct 27 '21 14:10 fulviocesile