Skip to content
This repository has been archived by the owner on Feb 25, 2024. It is now read-only.

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

Open
4 tasks done
a1ym opened this issue Feb 14, 2020 · 33 comments
Open
4 tasks done
Labels

Comments

@a1ym
Copy link

a1ym commented Feb 14, 2020

Before submitting an issue, make sure you have:

  • Updated to the lastest version
  • Read the README
  • Searched the bugtracker for similar issues including closed ones
  • Reviewed the sample code in tests and examples

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!

@a1ym a1ym added the question label Feb 14, 2020
@bruvv
Copy link
Collaborator

bruvv commented Feb 14, 2020

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

@a1ym
Copy link
Author

a1ym commented Feb 14, 2020

@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?

Repository owner deleted a comment from a1ym Feb 15, 2020
@kozyemoloko
Copy link

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
Copy link
Author

a1ym commented Feb 21, 2020

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
Copy link
Collaborator

bruvv commented Feb 21, 2020

@kozyemoloko do my best :)

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

@a1ym
Copy link
Author

a1ym commented Feb 21, 2020

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
Copy link
Collaborator

bruvv commented Feb 21, 2020

can you than eleborate this sentence?

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

@a1ym
Copy link
Author

a1ym commented Feb 21, 2020

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
Copy link

@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
Copy link
Author

a1ym commented Feb 23, 2020

@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
Copy link

prundianudaniel commented Feb 29, 2020

any news? Have the same issue...

@a1ym
Copy link
Author

a1ym commented Feb 29, 2020

Nope, couldn't find any solution yet :(

@nizarganteng
Copy link

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
Copy link

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
Copy link

how do we save cookies ?

@a1ym
Copy link
Author

a1ym commented Mar 4, 2020

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
Copy link

alimehdipk commented Mar 4, 2020

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
Copy link

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

@nizarganteng
Copy link

@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
Copy link

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
Copy link

soulpawa commented Mar 6, 2020

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
Copy link

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
Copy link
Author

a1ym commented Mar 12, 2020

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
Copy link

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
Copy link

leon-wbr commented Apr 8, 2020

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

@returnWOW
Copy link

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
Copy link

leon-wbr commented Apr 8, 2020

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

@returnWOW
Copy link

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
Copy link

leon-wbr commented Apr 8, 2020

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

@leon-wbr
Copy link

leon-wbr commented Apr 8, 2020

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:

  • Log into instagram using your browser, use the inspector to get cookie parameters (use Google if you don't know how to do this)
  • Create a file in the config subdirectory called {username}_uuid_and_cookie.json with this content:
{
  "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)"
}
  • In the file, you need to replace the xxx values with the values from your cookie.
  • Upon starting your script, it will detect the cookie as broken and try logging in again, which will now work.

Not guaranteed to work, but did for me.

@leon-wbr
Copy link

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
Copy link
Collaborator

bruvv commented Apr 12, 2020

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

@a1ym
Copy link
Author

a1ym commented Apr 12, 2020

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

10 participants