ohld / igbot

🐙 Free scripts, bots and Python API wrapper. Get free followers with our auto like, auto follow and other scripts!
https://hikerapi.com/p/N2P6iqiM
Apache License 2.0
4.69k stars 1.47k forks source link

[QUESTION] Can't login (Checkpoint challenge required/Not possible to log in) #1293

Open a1ym opened 4 years ago

a1ym commented 4 years ago

Before submitting an issue, make sure you have:

Which example file are you using?

follow_user_followers.py

Describe your Question/Issue:

I have looked at all the issues and "fixes" but nothing seems to work. I tried: resetting password and deleting the secret.txt file enableing/disableing 2FA temporarely disableing my account for 3 hours and logging in with the bot all of these methods got me to the same issue. The other fixes I took a look at involved modifying the script which for me wasn't explained clear enough how to do it. Instead of linking the previous issues (all of which I've looked at), please share what could be done. Thank you!


Paste the output of python -V here: Python 3.8.0

Code you are using:


"""
    instabot example
    Workflow:
        Follow user's followers by username.
"""

import argparse
import os
import sys

sys.path.append(os.path.join(sys.path[0], "../"))
from instabot import Bot  # noqa: E402

parser = argparse.ArgumentParser(add_help=True)
parser.add_argument("-u", type=str, help="username")
parser.add_argument("-p", type=str, help="password")
parser.add_argument("-proxy", type=str, help="proxy")
parser.add_argument("users", type=str, nargs="+", help="users")
args = parser.parse_args()

bot = Bot()
bot.login(username=args.u, password=args.p, proxy=args.proxy, ask_for_code=True)

for username in args.users:
    bot.follow_followers(username)

Error/Debug Log:

#This is when the 2FA is enabled:
2020-02-13 23:54:07,543 - DEBUG - POST to endpoint: challenge/27616976567/xRUOIHorKe/ returned response: <Response [200]>
2020-02-13 23:54:07,543 - ERROR - Not possible to log in. Reset and try again
2020-02-13 23:54:07,544 - ERROR - Failed to login
2020-02-13 23:54:07,544 - INFO - Username or password is incorrect.

#When 2FA is disabled:
2020-02-13 23:48:04,231 - ERROR - Request returns 400 error!
2020-02-13 23:48:04,231 - INFO - Instagram's error message: challenge_required
2020-02-13 23:48:04,231 - INFO - Error type: checkpoint_challenge_required
2020-02-13 23:48:04,232 - INFO - Checkpoint challenge required...
2020-02-13 23:48:04,232 - INFO - Follow followers of: user
2020-02-13 23:48:04,232 - CRITICAL - Not logged in!
bruvv commented 4 years ago

Can you post the full log file that is in log directory ?

a1ym commented 4 years ago

@bruvv here you go:

2020-02-14 14:24:00,213 - instabot version: 0.107.0 (bot) - INFO - Instabot version: 0.107.0 Started
2020-02-14 14:24:07,386 - instabot version: 0.107.0 (api_login) - INFO - PRE-LOGIN FLOW!... 
2020-02-14 14:24:16,574 - instabot version: 0.107.0 (api) - ERROR - Request returns 400 error!
2020-02-14 14:24:16,574 - instabot version: 0.107.0 (api) - INFO - Instagram's error message: challenge_required
2020-02-14 14:24:16,574 - instabot version: 0.107.0 (api) - INFO - Error type: checkpoint_challenge_required
2020-02-14 14:24:16,574 - instabot version: 0.107.0 (api) - INFO - Checkpoint challenge required...
2020-02-14 14:24:16,574 - instabot version: 0.107.0 (bot_follow) - INFO - Follow followers of: user
2020-02-14 14:24:16,574 - instabot version: 0.107.0 (api) - CRITICAL - Not logged in!

@bruvv any ideas?

kozyemoloko commented 4 years ago

I have exactly the same problem. I also tried many fixes that are in the issue section and nothing works. @bruvv seems like you can help?

a1ym commented 4 years ago

I just realised that I can log in when running "python instabot_py" line with the config. After I ran it, a .session file was created for my username. Perhaps there is a way to use the created .session file with the script i'm trying to run?

bruvv commented 4 years ago

@kozyemoloko do my best :)

@mamk02 what do you mean? What script do you run? can you copy paste the code between code markups?

a1ym commented 4 years ago

I meant that I use the follow_user_followers.py from the examples folder: https://github.com/instagrambot/instabot/blob/master/examples/follow_user_followers.py I also posted the code above in the first comment.

bruvv commented 4 years ago

can you than eleborate this sentence?

I just realised that I can log in when running "python instabot_py" line with the config.

a1ym commented 4 years ago

So I only get the error when I type in the cmd "python follow_user_followers.py user". However when I type in cmd "python instabot_py" (with the instabot.config.yml where i specified the username, password and other details), the bot logs in without any errors.

kozyemoloko commented 4 years ago

@bruvv thank you!

@mamk02 I also tried what you did (running “python instabot_py”) and it worked for me. But just like you said, it still cannot log in when running one of the example scripts. Someone suggested to try using a VPN; which I tried and was unsuccessful.

a1ym commented 4 years ago

@bruvv sorry I meant the other git. https://github.com/instabot-py/instabot.py this one works for me. I didn't realise that these projects are not related to each other.

prundianudaniel commented 4 years ago

any news? Have the same issue...

a1ym commented 4 years ago

Nope, couldn't find any solution yet :(

nizarganteng commented 4 years ago

yeah i have the same issue... ,I have tried to give suggestions, the suggestions is "I think you need to use the script saving cookies, so when I accept the login challenge, this challenge in the next login is not show again" ,like this script https://github.com/instabot-py/instabot.py he use that method (saving cookies)

alimehdipk commented 4 years ago

I started using this bot yesterday. I had no issue until today when I tried with another account. to my understanding, you are not saving the cookies. as @nizarganteng mentioned you have to save the cookies. I tried duplicating the cookies and updated the detail of the cookies from my chrome's login cookies. and Viola! it worked.

alicnakar commented 4 years ago

how do we save cookies ?

a1ym commented 4 years ago

Thanks for the suggestion. But i don't really know how to do that. Could you please explain how it could be done? Thank you!

alimehdipk commented 4 years ago

you have to create a cookie.json file even in the case of unsuccessful login save all the info needed in that file. just like you are creating in a successful login.

alicnakar commented 4 years ago

ımm sorry, with which codes can I create :(

nizarganteng commented 4 years ago

@bruvv maybe you can learn this script https://github.com/instabot-py/instabot.py he script is include save cookies ,but the problem that script in me is "Trying to comment" (not succes comment)

alicnakar commented 4 years ago

you have to create a cookie.json file even in the case of unsuccessful login save all the info needed in that file. just like you are creating in a successful login.

I export instagram cookies from chrome. How do i use this. teach me teacher :)

soulpawa commented 4 years ago

I was able to jump checkpoint challenge using the correct python

before I was using python like_hashtag.py #god and I was getting the error, as soon as I changed to: python3.7 like_hashtag.py #god the challenge error just gone.

nizarganteng commented 4 years ago

I was able to jump checkpoint challenge using the correct python

before I was using python like_hashtag.py #god and I was getting the error, as soon as I changed to: python3.7 like_hashtag.py #god the challenge error just gone.

i try use Python 3.7.6 still get Error type: checkpoint_challenge_required

a1ym commented 4 years ago

i try use Python 3.7.6 still get Error type: checkpoint_challenge_required

same... i guess using the cookies is the only way to solve this problem but i still couldnt figure out how to do that.

returnWOW commented 4 years ago

instabot api saved cookie like this(path in config, named xxx_uuid_and_cookie.json,'xxx' should replace by your ins username),you should modify some value like phone_id or uuid by random,and replace some cookie value by success login by browser(like csrftoken......). modified and save the session file in config path, first login with the session file should show error logout,but finally should be success.This is the way from my tested.Sorry for my bad English.

The session json: {"uuids": {"phone_id": "5c7ee0b5-d418-4c81-b262-01604e720930", "uuid": "4e8eb26e-aa37-49d1-b15d-304a55e9aa39", "client_session_id": "6aad754e-0112-4e9c-8219-64ffd8dd42e7", "advertising_id": "3f0397c6-5505-1123-ba15-5cc3a88cce06", "device_id": "android-3f8a0210d66a528e"}, "cookie": {"csrftoken": "xxx", "ds_user": "user_namexxx", "ds_user_id": "xxx", "ig_direct_region_hint": "ATN", "igfl": "user_namexxx", "is_starred_enabled": "yes", "mid": "xxx", "rur": "VLL", "sessionid": "xxx", "shbid": "8030", "shbts": "1584716107.9241214", "urlgen": "xxx", "timing_value": {"last_login": 1584284362.348525, "last_experiments": 1584284361.195544}, "device_settings": {"app_version": "117.0.0.28.123", "android_version": "28", "android_release": "9.0", "dpi": "420dpi", "resolution": "1080x1920", "manufacturer": "OnePlus", "device": "ONEPLUS A3003", "model": "OnePlus3", "cpu": "qcom", "version_code": "180322800"}, "user_agent": "Instagram 117.0.0.28.123 Android (28/9.0; 420dpi; 1080x1920; OnePlus; ONEPLUS A3003; OnePlus3; qcom; en_US; 180322800)"}

leon-wbr commented 4 years ago

I can't find the file you're referring to, @returnWOW. Any help?

returnWOW commented 4 years ago

I can't find the file you're referring to, @returnWOW. Any help?

You can copy my above commented json string, to replace your account cookie on json key "cookie" area, after, Save the file in code path called "./config", right now you can try to using your account name to login. waiting few minutes and see login success. Sorry foy my bad English.

leon-wbr commented 4 years ago

I don't understand how this file is supposed to be loaded, do I need to add anything to my configuration? @returnWOW

returnWOW commented 4 years ago

I don't understand how this file is supposed to be loaded, do I need to add anything to my configuration? @returnWOW

from api, login succeed, after ,this file auto maintained (generate)by api, but you can first make it by your self, so in this way can jump through login check challenging

leon-wbr commented 4 years ago

Getting a KeyError for timing_value now @returnWOW, any ideas?

leon-wbr commented 4 years ago

Well, the cookie just logs out the device I got it from, giving back 403.

Edit: Nevermind. It detects the cookie as broken and tries logging in again, which promptly works. Interesting! How to:

{
  "uuids": {
    "phone_id": "5c7ee0b6-d420-4c83-b252-01503e701340",
    "uuid": "4e3eb35e-aa39-39d1-b16d-204a45e4aa73",
    "client_session_id": "6abc534e-0213-5e3c-2159-64eef3dd42e7",
    "advertising_id": "3f0397c6-5505-1123-ba15-5dd3a8acce06",
    "device_id": "android-3f8a1301e66b623e"},
    "cookie": {
      "csrftoken": "xxx",
      "ds_user": "xxx (your username)",
      "ds_user_id": "xxx",
      "ig_direct_region_hint": "FRC",
      "ig_did": "xxx",
      "igfl": "xxx (your username)",
      "is_starred_enabled": "yes",
      "mid": "xxx",
      "rur": "xxx",
      "sessionid": "xxx",
      "shbid": "xxx",
      "shbts": "xxx",
      "urlgen": "xxx"
    },
    "timing_value": {
      "last_login": 1584284362.348525,
      "last_experiments": 1584284361.195544
    },
    "device_settings": {
      "app_version": "117.0.0.28.123",
      "android_version": "28",
      "android_release": "9.0",
      "dpi": "420dpi",
      "resolution": "1080x1920",
      "manufacturer": "Huawei",
      "device": "Mate 10 Pro",
      "model": "Mate 10 Pro",
      "cpu": "qcom",
      "version_code": "180322800"
    },
    "user_agent": "Instagram 117.0.0.28.123 Android (28/9.0; 420dpi; 1080x1920; Huawei; HUAWEI MATE 10 PRO; Mate10Pro; qcom; de_DE; 180322800)"
}

Not guaranteed to work, but did for me.

leon-wbr commented 4 years ago

This should be marked as an actual issue since the bug is somewhat consistently reproducible.

If someone is willing to try out a proper fix, I'm thinking it'd probably be possible to avoid the checkpoint by using a usual browser user agent. After any successful login, we could switch the cookie over to use a mobile user agent again to gain all functions.

bruvv commented 4 years ago

That will be great if we can develop that. Does that mean we should include selenium ?

a1ym commented 4 years ago

@leon-wbr wow thank you so much! It's finally working for me! :D