UnhandledPromiseRejectionWarning: StatusCodeError: 403 - "{\"message\":\"login_required\",\"status\":\"fail\"}"
(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.
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.
I've already logged in, but this error still gives.
Same
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.
Same issue, I trued getting profile and it returns me an undefined value in the console.
Figured it out, I forgot I changed Instagram username and didn't update it in my .env file. 😝
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