fbchat-asyncio icon indicating copy to clipboard operation
fbchat-asyncio copied to clipboard

Can't log in, Facebook stops at checkpoint

Open AJRadaza opened this issue 5 years ago • 1 comments

Description of the problem

When logging in, Facebook stops the API at their checkpoint site, https://m.facebook.com/checkpoint/?_rdr

Code to reproduce

from fbchat import Client, ThreadType
import asyncio
import json

class EchoBot(Client):
    async def on_message(self, mid=None, author_id=None, message_object=None, thread_id=None,
                         thread_type=ThreadType.USER, at=None, metadata=None, msg=None):
        await self.mark_as_delivered(thread_id, message_object.uid)
        await self.mark_as_read(thread_id)

        if author_id != self.uid:
            await self.send(message_object, thread_id=thread_id, thread_type=thread_type)

loop = asyncio.get_event_loop()

async def start():
    credentials = None
    email = None
    password = None

    with open("../config/config.json") as f:
        credentials = json.load(f)
        email = credentials['email']
        password = credentials['password']

    client = EchoBot(loop=loop)
    print("Logging in...")
    await client.start(email, password)
    client.listen()

loop.run_until_complete(start())
loop.run_forever()

Traceback

Logging in...
Traceback (most recent call last):
  File "testecho.py", line 37, in <module>
    loop.run_until_complete(start())
  File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
    return future.result()
  File "testecho.py", line 33, in start
    await client.start(email, password)
  File "/home/jukiro/.local/lib/python3.7/site-packages/fbchat/_client.py", line 104, in start
    await self.login(email, password)
  File "/home/jukiro/.local/lib/python3.7/site-packages/fbchat/_client.py", line 211, in login
    loop=self.loop, log=self._state_log
  File "/home/jukiro/.local/lib/python3.7/site-packages/fbchat/_state.py", line 156, in login
    "(Failed on url: {})".format(resp.url)
fbchat._exception.FBchatException: Login failed. Check email/password. (Failed on url: https://m.facebook.com/checkpoint/?_rdr)
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f95cdf6ad30>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x7f95ce04be80>, 5339.940801688)]']
connector: <aiohttp.connector.TCPConnector object at 0x7f95cdf6aba8>

Environment information

  • Python 3.7.3
  • fbchat 0.3.0

AJRadaza avatar Feb 15 '20 06:02 AJRadaza

pretty sure this is just facebook detecting a "sketchy" login, if you login to your fb account normally it should tell you that

zykrah avatar Apr 22 '20 03:04 zykrah