Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cookie is not a constructor #258

Open
Barno opened this issue Jun 9, 2021 · 2 comments
Open

Cookie is not a constructor #258

Barno opened this issue Jun 9, 2021 · 2 comments

Comments

@Barno
Copy link

Barno commented Jun 9, 2021

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
Copy link

Please share your entire code so we can help you

@Barno
Copy link
Author

Barno commented Jun 19, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants