jlobos / instagram-web-api

🤳 Instagram Private Web API client for Node
https://npmjs.com/instagram-web-api
MIT License
1.12k stars 186 forks source link

Cookie is not a constructor #258

Open Barno opened 3 years ago

Barno commented 3 years ago

I'm using that command to login in https://github.com/jlobos/instagram-web-api#instagramcredentials-opts

const client = new Instagram({ username: '', password: '' })

But I get that error: TypeError: Cookie is not a constructor

MonsieurBibo commented 3 years ago

Please share your entire code so we can help you

Barno commented 3 years ago

Hello thanks for the reply. With debug I can see that the problem is on :

    const request = require('request-promise-native')
    const jar = request.jar(cookieStore)
    jar.setCookie(request.cookie('ig_cb=1'), baseUrl)

My Controller:

exports.index = async (req, res) => {

    const client = new Instagram( {"username":"XXXX","password":"XXX"} )

    console.dir(client);

    res.render('instagram/index', {
        title: 'Instagram'
    });
};

My dependencies

"@fortawesome/fontawesome-free": "^5.15.3",
    "@ladjs/bootstrap-social": "^7.0.2",
    "axios": "^0.19.2",
    "body-parser": "^1.19.0",
    "bootstrap": "^4.6.0",
    "bootstrap-social": "^5.1.1",
    "chalk": "^4.1.1",
    "clipboard": "^2.0.8",
    "coinmarketcap-api": "^3.1.1",
    "compression": "^1.7.4",
    "connect-mongo": "^3.2.0",
    "cron": "^1.8.2",
    "datepicker-moment": "^2.0.2",
    "dialogs": "^2.0.1",
    "dotenv": "^8.2.0",
    "errorhandler": "^1.5.1",
    "express": "^4.17.1",
    "express-flash": "^0.0.2",
    "express-handlebars": "^5.3.0",
    "express-session": "^1.17.1",
    "express-status-monitor": "^1.3.3",
    "fs": "*",
    "google-drive-sheets": "^1.3.1",
    "google-spreadsheet": "^3.1.15",
    "googleapis": "^39.2.0",
    "html-to-text": "^5.1.1",
    "http": "*",
    "https": "^1.0.0",
    "instagram-web-api": "^2.2.2",
    "jquery": "^3.6.0",
    "jsonfile": "^6.1.0",
    "lodash": "^4.17.21",
    "lusca": "^1.7.0",
    "moment": "^2.29.1",
    "moment-timezone": "^0.5.33",
    "mongoose": "^5.12.5",
    "morgan": "^1.10.0",
    "node-sass": "^4.14.1",
    "node-sass-middleware": "^0.11.0",
    "node-telegram-bot-api": "^0.50.0",
    "nodemailer": "^6.5.0",
    "nodemailer-sendgrid": "^1.0.3",
    "popper.js": "^1.16.1",
    "pug": "^3.0.2",
    "puppeteer": "^5.5.0",
    "puppeteer-core": "^5.5.0",
    "sanitize-html": "^2.4.0",
    "socket.io": "^4.1.2",
    "twitter-lite": "^0.14.0",
    "validator": "^13.6.0"

Thanks