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

Problem in simple login #80

Open kimia000 opened 5 years ago

kimia000 commented 5 years ago

I try to simply log in as

const Instagram = require('instagram-web-api');
const client = new Instagram({ username: 'XX', password: 'YY' });

(async () => {
   await client.login();
   const profile = await client.getProfile();
})();

but it returns the error:

TypeError: Cannot read property 'map' of undefined
    at request.then.res (/home/kimia/node_modules/instagram-web-api/lib/index.js:55:46)
    at processTicksAndRejections (internal/process/task_queues.js:86:5)
franzsilva commented 5 years ago

I would place the code inside a try catch. so you can catch any errors returned.

const Instagram = require('instagram-web-api');
const client = new Instagram({ username: 'XX', password: 'YY' });

(async () => {
    try {
        await client.login();
        const profile = await client.getProfile();
        console.log("Profile:", profile);
    } catch (error) {
        console.log("Error:", error);
    }

})();
TheRTK commented 5 years ago

I have same problem!

Instagram does not send header "set-cookie".

instagram-web-api/lib/index.js:55:46 .then(res => res.headers['set-cookie'].map(Cookie.parse))

Aljal commented 5 years ago

Same problem here can someone help us pls ?

gutosanches commented 5 years ago

Looks like the package is outdated in npm. I fixed that by installing the package using the master branch putting this in my package.json: "instagram-web-api": "https://github.com/jlobos/instagram-web-api.git"

MonsieurBibo commented 3 years ago

Is it still relevant ? If not can you close this issue please ?

ruskid commented 2 years ago

still relevant