Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Login failed for 2FA enabled account. #555

Open
MS-Jahan opened this issue Apr 18, 2020 · 0 comments
Open

Login failed for 2FA enabled account. #555

MS-Jahan opened this issue Apr 18, 2020 · 0 comments
Labels

Comments

@MS-Jahan
Copy link

MS-Jahan commented Apr 18, 2020

Description of the problem

Can't login to the account which have 2FA enabled. Login works fine with the account which doesn't have 2FA enabled.

Code I'm using:

def login_logout():
    cookies = {}
    try:
        # Load the session cookies
        if os.path.isfile('session.json'):
            with open('session.json', 'r') as f:
                cookies = json.load(f)
    except:
        os.remove('session.json')
        # If it fails, never mind, we'll just login again
        # client = CustomClient(email, password, max_tries=1)
    if((not cookies) != True):
        client = CustomClient(email, password, session_cookies=cookies, user_agent=user_agent, max_tries=1)
    else:
        client = CustomClient(email, password, user_agent=user_agent, max_tries=1)
    
    with open('session.json', 'w') as f:
        json.dump(client.getSession(), f)

    print("\nProgram Started!\n")
    client.listen()

Error I'm getting

Traceback (most recent call last):
  File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python36\lib\site-pa
ckages\fbchat\_client.py", line 175, in setSession
    self._state = State.from_cookies(session_cookies, user_agent=user_agent)
  File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python36\lib\site-pa
ckages\fbchat\_state.py", line 208, in from_cookies
    return cls.from_session(session=session)
  File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python36\lib\site-pa
ckages\fbchat\_state.py", line 186, in from_session
    fb_dtsg = FB_DTSG_REGEX.search(r.text).group(1)
AttributeError: 'NoneType' object has no attribute 'group'

Environment information

  • Python version 3.6.8
  • fbchat version 1.9.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants