ReferenceError: sessionID is not defined
at Instagram.auth.then (C:\Users\samuc\projetos\instabot\app.js:25:21)
at process._tickCallback (internal/process/next_tick.js:68:7)
My complete code:
const express = require('express');
const app = express();
let Instagram = require('instagram-nodejs-without-api');
Instagram = new Instagram();
let idOfSession = "Random, only for tests";
let csrfTokenOfSession = "Random, only for tests";
Instagram.getCsrfToken()
.then((csrf) =>
{
Instagram.csrfToken = csrf;
csrfTokenDaSessao = csrf;
console.log(csrf);
console.log(csrfTokenOfSession);
})
.then( () =>
{
return Instagram.auth('correctUser', 'correctPass')
.then( (sessionId) =>
{
Instagram.sessionId = sessionId
idDaSessao = sessionID;
console.log(sessionId);
console.log(idOfSession);
});
})
.catch(console.error);
app.listen(3000, () => {
console.log("Running at port 3000")
});
I had this issue when run the basic code:
My complete code: