mathdroid / igdm-cli

💻💬 Instagram Direct Messages in your terminal
129 stars 28 forks source link

Can't log in: CookieNotValidError #4

Open kristjanvariksoo opened 6 years ago

kristjanvariksoo commented 6 years ago

screenshot from 2018-04-23 21-24-19

Tried logging in multiple times on multiple machines, made sure I used the correct password and It still won't work.

I also tried entering an incorrect password. The application did not give this error in that case instead correctly saying, I had entered the wrong password.

The application also handled me trying to log in with a non existant username, giving me the appropriate error.

I also tried logging in to two different instagram accounts, both produced identical results. I'm using Debian 9.4 Stretch and installed the app using sudo -H npm i -g igdm-cli and did not encounter any issues during installing.

While installing, I did get a warning that said something about cookies and deprecation however. I ignored it at install, but, maybe it has something to do with the issue. screenshot from 2018-04-23 21-31-06

nishelanutella commented 6 years ago

even when i log in it says ''cookie sessionid'' can we fix it??

let me know ASAP :disappointed:

kristjanvariksoo commented 6 years ago

I looked into it, the problem appears to come from the npm package instagram-private-api. The issue is tracked on their repo too - https://github.com/huttarichard/instagram-private-api/issues/462 - there are a few workarounds there.

If you really need to get it working then using one of those workarounds I got it working, you can just copy this entire repo and install the dependencies, then go into "node_modules/instagram-private-api/client/v1/cookie-storage.js" and manually change line 26 from: self.storage.findCookie(CONSTANTS.HOSTNAME, '/', name, function(err, cookie) {

to

self.storage.findCookie('instagram.com', '/', name, function(err, cookie) {

It worked for me.

mathdroid commented 6 years ago

I'm trying to replicate the issue, so far I can't seem to successfully do it.

My system is MacOS Sierra 10.13.3. Will try to update very soon.

mathdroid commented 6 years ago

@kristjanvariksoo @nishelanutella

For quick fix, have you tried using persist (-s) mode? It will save the credentials inside a JSON file instead of storing the cookie in memory.

cookie

igdm -s -u <username> -p <password>

Let me know if it helps.

kristjanvariksoo commented 6 years ago

That didn't work. screenshot from 2018-04-24 11-50-57

mathdroid commented 6 years ago

We're going to wait for a fix from here in the meantime. #462

checho221 commented 6 years ago

I got the same when trying all solutions on #462. Now i am using 7 accounts with my own directs app, particularly only one account is getting this issue, others are working fine...

mathdroid commented 6 years ago

I'm sorry for slow response. I can't replicate the issue with my accounts and devices. Do you have any fixes that can be made into a PR?

On Wed, May 2, 2018, 11:05 PM checho221 notifications@github.com wrote:

I got the same when trying all solutions on #462. Now i am using 7 accounts with my own directs app, particularly only one account is getting this issue, others are working fine...

— You are receiving this because you were assigned.

Reply to this email directly, view it on GitHub https://github.com/mathdroid/igdm-cli/issues/4#issuecomment-386030966, or mute the thread https://github.com/notifications/unsubscribe-auth/ADkzMlCrNg16i2-cP6ApIWW3xlHFP4ouks5tudk6gaJpZM4TgZvp .

checho221 commented 6 years ago

for now i cloned https://github.com/ifedapoolarewaju/instagram-private-api/ and edit jar.js to:

RequestJar.prototype.setCookie = function(cookieOrStr, uri, options) { cookieOrStr = cookieOrStr.replace(/Domain=\.?instagram\.com;\s?/,''); uri = this.rewriteUri(uri); return this._jar.setCookieSync(cookieOrStr, uri, options || {}); };

It is working for now...

checho221 commented 6 years ago

@mathdroid editing jar.js is not working, look at this comment https://github.com/huttarichard/instagram-private-api/issues/462#issuecomment-386074934

checho221 commented 5 years ago

I am not using cookies from memory but from file, so i have a copy of my cookies and when it happens so i call for the backup copy of my cookies.

i have a question...haow do you prevent sentryblock or spam with this lib? do you know a webhook for instagram inbox?