b31ngd3v / MyIGBot

MyIGBot is a Private API for Instagram to like, follow, comment, view & intaract with stories, upload post & stories, get all information about a user/posts and get posts based on locations/hashtags. It also supports proxy.
https://pypi.org/project/myigbot/
MIT License
172 stars 36 forks source link

Login Not Working #12

Closed trashmit closed 3 years ago

trashmit commented 3 years ago

KeyError: "name='csrftoken', domain=None, path=None"

just tried to login and this error came up

from myigbot import MyIGBot

bot = MyIGBot('xxx', 'xxx')
b31ngd3v commented 3 years ago

Are you working on vps ?

trashmit commented 3 years ago

Nope, no reason for it to confirm or something

b31ngd3v commented 3 years ago

This bug is already fixed by @animemoeus If you use this repo instade of the module you'll not face the issue. I'll add the fix on the next update of the module. Thank you 😊

trashmit commented 3 years ago

Nope, that's not working either i'm not getting any cookies at all maybe its cause im on a mac and the user agent isn't sent in the first response?

trashmit commented 3 years ago

the first request *

b31ngd3v commented 3 years ago

@trashmit My client is using the same module on his Mac, he has no issues. So the os doesn't matter in this case.

devtobi commented 3 years ago

For me its not working either, also not with @animemoeus fork. Using Big Sur 11.0.1 with Python 3.9.0.

b31ngd3v commented 3 years ago

Hey @devtobi are you facing the same issue ?

KeyError: "name='csrftoken', domain=None, path=None"

animemoeus commented 3 years ago

KeyError: "name='csrftoken', domain=None, path=None"

just tried to login and this error came up

from myigbot import MyIGBot

bot = MyIGBot('xxx', 'xxx')

I have faced the same issue and after change link = 'https://www.instagram.com/accounts/login/' to link = 'https://www.instagram.com/' it's working for me.

You can try to use the default link (link = 'https://www.instagram.com/accounts/login/') if my solution doesn't work.

devtobi commented 3 years ago

Hey @devtobi are you facing the same issue ?

KeyError: "name='csrftoken', domain=None, path=None"

Yes its exactly the same issue.

trashmit commented 3 years ago

My cookie jar is returning empty so I assume that's where the error is coming from I tried switching the link to both urls and it isn't working

animemoeus commented 3 years ago

My cookie jar is returning empty so I assume that's where the error is coming from I tried switching the link to both urls and it isn't working

In my experience, the cookie_jar csrftoken error occurs because I use the bot too often. When I try again with another IP then it works again.

b31ngd3v commented 3 years ago

My cookie jar is returning empty so I assume that's where the error is coming from I tried switching the link to both urls and it isn't working

You can try proxy, residential proxies are better for this type of work.

animemoeus commented 3 years ago

My cookie jar is returning empty so I assume that's where the error is coming from I tried switching the link to both urls and it isn't working

You can try proxy, residential proxies are better for this type of work.

Yes, since I use cron jobs to run the bot every hour, I use the proxy feature.

Before using a proxy, I often get the cookie_jar csrftoken error when the bot is running for hours.

trashmit commented 3 years ago

I got a temporary fix to the problem by setting the csrf token in the first response manually to a random string, it works for now but shouldn't be a permanent fix

b31ngd3v commented 3 years ago

@trashmit @devtobi Just Fixed The Login Issue