dilame / instagram-private-api

NodeJS Instagram private API SDK. Written in TypeScript.
MIT License
5.99k stars 1.14k forks source link

Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED on Session Create #698

Closed vanvanni closed 5 years ago

vanvanni commented 5 years ago
(node:3584) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
Unhandled rejection RequestError: Invalid Parameters

I get this error when I call Client.Session.create(device, storage, process.env.IG_USER, process.env.IG_PASSWORD)... I have been searching around to find a solution but can't find the right one. How should I fox this for this package?

inoyakaigor commented 5 years ago

@xJoeyv this warning from Node not this package. Answer is here

vanvanni commented 5 years ago

@inoyakaigor I found that solution but did not fix the problem. My Code

require('dotenv').config();
// const fb = require("facebook-chat-api");

console.log(`Logging Value`);
console.log(process.env.NODE_TLS_REJECT_UNAUTHORIZED);
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
console.log(`Updated Value`);
console.log(process.env.NODE_TLS_REJECT_UNAUTHORIZED);

(async () => {
    console.log(`STARTING CODE`);
    const ig = require("./lib/ig");
    const Instagram = await ig();

    console.log('Tada');
})();

The Log

Logging Value
undefined
Updated Value
0
STARTING CODE
Tada
(node:10864) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
Unhandled rejection CheckpointError: Instagram call checkpoint for this action!
ifedapoolarewaju commented 5 years ago

The warning is thrown because it is set to 0. I think you should be setting it to 1 instead. As in:

process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 1;