Python fbchat - Login failed

烂漫一生 提交于 2021-02-11 08:27:24

问题


I am currently trying to use fbchat (https://github.com/carpedm20/fbchat) to build a small FB-Bot, but I can not login with fbchat.

I took the code directly from the examples, but when I try to login it fails. In Facebook I do get the message, that someone with an unknown browser tried to login - I accept this message ("This was me") but it is shown everytime I try to login via the script. Username and Password are correct.

import fbchat
client = fbchat.Client("123456789", "987654321")
friends = client.getUsers("FRIEND'S NAME")  # return a list of names

Any ideas?

Thank you


回答1:


Are you running the code on a vps or from an IP address different than the one that you usually use to log in to your Facebook account?

If so, try SSH tunneling through that IP address, and login to Facebook with a browser.

The point is, you need to login to Facebook with a browser from that IP address. There are some verification steps that can only be done with a browser. FB will also ask you to change your password, follow through and do it. Then, your code should be good to go. You might have to do this again after a few hours if your client disconnects, but after 3-4 times, FB will acknowledge the new IP address as "safe" and you'll be all set.



来源:https://stackoverflow.com/questions/41399539/python-fbchat-login-failed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!