fbchat icon indicating copy to clipboard operation
fbchat copied to clipboard

Can't Log in

Open CaptainCaramel opened this issue 3 years ago • 8 comments
trafficstars

I'm trying to log in, but I can't The code is: from fbchat import Client from fbchat.models import * if not client.isLoggedIn(): client = Client('PHONE', 'PASS')

The Traceback: Logging in PHONE NUMBER... Attempt #1 failed, retrying Traceback (most recent call last): File "C:\Users\MemeB\AppData\Local\Programs\Python\Python310\lib\site-packages\fbchat_client.py", line 205, in login self._state = State.login( File "C:\Users\MemeB\AppData\Local\Programs\Python\Python310\lib\site-packages\fbchat_state.py", line 151, in login return cls.from_session(session=session) File "C:\Users\MemeB\AppData\Local\Programs\Python\Python310\lib\site-packages\fbchat_state.py", line 190, in from_session revision = int(r.text.split('"client_revision":', 1)[1].split(",", 1)[0]) IndexError: list index out of range ( then it retries 3 more times ) IndexError: list index out of range Traceback (most recent call last): File "O:\P\Messenger_script.py", line 3, in client = Client('PHONENUMBER', 'PASSWORD') File "C:\Users\MemeB\AppData\Local\Programs\Python\Python310\lib\site-packages\fbchat_client.py", line 103, in init self.login(email, password, max_tries, user_agent=user_agent) File "C:\Users\MemeB\AppData\Local\Programs\Python\Python310\lib\site-packages\fbchat_client.py", line 205, in login self._state = State.login( File "C:\Users\MemeB\AppData\Local\Programs\Python\Python310\lib\site-packages\fbchat_state.py", line 151, in login return cls.from_session(session=session) File "C:\Users\MemeB\AppData\Local\Programs\Python\Python310\lib\site-packages\fbchat_state.py", line 190, in from_session revision = int(r.text.split('"client_revision":', 1)[1].split(",", 1)[0]) IndexError: list index out of range

Python 3.10.0 Fbchat 1.9.7

CaptainCaramel avatar Feb 24 '22 15:02 CaptainCaramel

@CaptainCaramel from what I see , Facebook (Meta) change a lot of stuff constantly and in the README which is displayed under the project it says that this library is no longer supported.

I saw that they utilize the m.facebook in order to login etc. if you manually go and try to open from your PC browser the part with messenger you are introduced to an error. The idea is that when you open mobile version from phone it will redirect to messenger app.

I dont think that this library can be reworked to work with messenger web-page , but if you or any other interested person has the needed knowledge , please help the community and re-work the logic.

minevsve avatar Apr 02 '22 13:04 minevsve

@CaptainCaramel i saw this thread https://github.com/fbchat-dev/fbchat/issues/656 , installed python3.7 and changed the value and everything works for me. Maybe something changed in latest python3.10 so just do that and you can use it

minevsve avatar Apr 02 '22 14:04 minevsve

image

Try changing revision to 1 _state.py

SisigSarino avatar May 03 '22 08:05 SisigSarino

Hello,

I did what you say @minevsve and @noahosmont but I have a similar issue:

File "/Users/David/.pyenv/versions/3.7.13/lib/python3.7/site-packages/fbchat/_client.py", line 209, in login user_agent=user_agent, File "/Users/David/.pyenv/versions/3.7.13/lib/python3.7/site-packages/fbchat/_state.py", line 155, in login "(Failed on url: {})".format(r.url) fbchat._exception.FBchatUserError: Login failed. Check email/password. (Failed on url: https://m.facebook.com/login.php?login_attempt=1) Attempt #2 failed, retrying Traceback (most recent call last): File "/Users/David/.pyenv/versions/3.7.13/lib/python3.7/site-packages/fbchat/_client.py", line 209, in login user_agent=user_agent, File "/Users/David/.pyenv/versions/3.7.13/lib/python3.7/site-packages/fbchat/_state.py", line 155, in login "(Failed on url: {})".format(r.url) fbchat._exception.FBchatUserError: Login failed. Check email/password. (Failed on url: https://m.facebook.com/login.php?login_attempt=1) Attempt #3 failed, retrying Traceback (most recent call last): File "/Users/David/.pyenv/versions/3.7.13/lib/python3.7/site-packages/fbchat/_client.py", line 209, in login user_agent=user_agent, File "/Users/David/.pyenv/versions/3.7.13/lib/python3.7/site-packages/fbchat/_state.py", line 155, in login "(Failed on url: {})".format(r.url) fbchat._exception.FBchatUserError: Login failed. Check email/password. (Failed on url: https://m.facebook.com/login.php?login_attempt=1) Attempt #4 failed, retrying Traceback (most recent call last): File "/Users/David/.pyenv/versions/3.7.13/lib/python3.7/site-packages/fbchat/_client.py", line 209, in login user_agent=user_agent, File "/Users/David/.pyenv/versions/3.7.13/lib/python3.7/site-packages/fbchat/_state.py", line 155, in login "(Failed on url: {})".format(r.url) fbchat._exception.FBchatUserError: Login failed. Check email/password. (Failed on url: https://m.facebook.com/login.php?login_attempt=1) Traceback (most recent call last): File "messenger_bot_sandra.py", line 13, in client = Client(username, password) File "/Users/David/.pyenv/versions/3.7.13/lib/python3.7/site-packages/fbchat/_client.py", line 103, in init self.login(email, password, max_tries, user_agent=user_agent) File "/Users/David/.pyenv/versions/3.7.13/lib/python3.7/site-packages/fbchat/_client.py", line 209, in login user_agent=user_agent, File "/Users/David/.pyenv/versions/3.7.13/lib/python3.7/site-packages/fbchat/_state.py", line 155, in login "(Failed on url: {})".format(r.url) fbchat._exception.FBchatUserError: Login failed. Check email/password. (Failed on url: https://m.facebook.com/login.php?login_attempt=1)

I ran this file with pyhton 3.7.13 (pyenv)

Do you have any idea of what can i do ?

thanks !

DavF27 avatar May 10 '22 16:05 DavF27

@DavidFrancisco27 we have the same problem, have you fixed it? I believe facebook changed something in their end which probably hasnt been worked out in this library

AlizerUncaged avatar Jun 08 '22 12:06 AlizerUncaged

Hi @AlizerUncaged, unfortunately I haven't fix this problem. I didn't look too much these days but at this point, I really want find a solution too.. The thing is, facebook and messenger are separate now. So I don't know if this code can still work even if we make some change on it.

DavF27 avatar Jun 08 '22 17:06 DavF27

Hello, i have this same issue, did somebody repair it?

Gorol21 avatar Jul 25 '22 18:07 Gorol21