question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

login fails, but active sessions are created on fb account

See original GitHub issue

Description of the problem

Sorry about posting another login issue, but I can’t seem to login even though the username and password are definitely correct, especially since I can see all 5 active sessions documented when I take a look at my FB profile.

I am not sure what’s causing “home” to not be part of the url after getting /login/save-device/cancel/. Traceback is below:

Code to reproduce

#!/usr/bin/env python3

from fbchat import Client
import getpass
import logging
logging.basicConfig(level=logging.DEBUG)
client = Client("<email>", getpass.getpass(prompt="Password: "))

Traceback

Logging in <email>...
INFO:client:Logging in <email>...
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): m.facebook.com:443
DEBUG:urllib3.connectionpool:https://m.facebook.com:443 "GET / HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:https://m.facebook.com:443 "POST /login.php?login_attempt=1 HTTP/1.1" 302 0
DEBUG:urllib3.connectionpool:https://m.facebook.com:443 "GET /login/save-device/?login_source=login&refsrc=https%3A%2F%2Fwww.facebook.com%2F&_rdr HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:https://m.facebook.com:443 "GET /login/save-device/cancel/ HTTP/1.1" 302 0
DEBUG:urllib3.connectionpool:https://m.facebook.com:443 "GET /?_rdr HTTP/1.1" 200 None
Attempt #1 failed, retrying
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/fbchat/_client.py", line 254, in login
    state = State.login(email, password, user_agent=user_agent)
  File "/usr/local/lib/python3.7/site-packages/fbchat/_state.py", line 139, in login
    "(Failed on url: {})".format(r.url)
fbchat._exception.FBchatUserError: Login failed. Check email/password. (Failed on url: https://m.facebook.com/?_rdr)
ERROR:client:Attempt #1 failed, retrying

And onward, 4 more times.

Environment information

  • Python version 3.7
  • fbchat version 1.7.2

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
madsmtmcommented, Jul 20, 2019

As @kapi2289 noted, the suggested fix was a rather temporary solution. I’ve fixed this properly in efc8776e709c960d27598a8443d4d479425c6984, by simply just adding an extra check for whether the URL was /.

Thanks for the detailed report, and for your patience, I’ve been on holiday for the past few weeks 😉

2reactions
apepenkovcommented, Jul 15, 2019

Coolkit-carl, in _state.py (line 134) add in if ‘or True’ That will solve the problem

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Recover a Facebook Account When You Can't Log In
Check If You're Still Logged In. It sounds silly, but the first thing to do if you find yourself logged out of your...
Read more >
I'm worried someone could login to my Facebook and ... - Quora
I'm worried someone could login to my Facebook and it somehow didn't show up in Activity Log in logins and logouts history, neither...
Read more >
How to Check If Someone Else Is Accessing Your Facebook ...
You can check if someone else is accessing your account by going to Settings and Privacy > Settings > Security and login >...
Read more >
Facebook Keeps Logging Me Out — How to Fix? - Beebom
8 Fixes When Facebook Keeps Logging You Out (2022) · 1. Clear Browser Cookies · 2. Wipe Facebook Cache · 3. Check Active...
Read more >
Fix Session Expired issue with Facebook 2022 - YouTube
Fix the Session Expired issue with Facebook App easily by doing the tips as shown in this video. Gain full access to your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found