meta-ai-api icon indicating copy to clipboard operation
meta-ai-api copied to clipboard

Kept getting error: "FacebookInvalidCredentialsException: Was not able to login to Facebook. You may also have been rate limited. Try to connect to Facebook manually."

Open snehitvaddi opened this issue 1 year ago • 4 comments

I’ve made multiple attempts but continue to receive the error: FacebookInvalidCredentialsException: Unable to login to Facebook. Please verify your credentials. You may have been rate limited. Attempt to connect to Facebook manually.

When I tried to log in manually, it requested email or phone verification.

I think the code needs to be revised to handle this scenario. It should select email verification in the backend and prompt the user to check their email and input the verification code.

snehitvaddi avatar Jul 15 '24 13:07 snehitvaddi

Seems the login functionality is busted:

@Jeremys-Mini workspace % python3 meta_ai.py 
Traceback (most recent call last):
  File "/Users/jeremyjustus/workspace/meta_ai.py", line 2, in <module>
    ai = MetaAI(fb_email="[email protected]", fb_password="XXXXXX")
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/meta_ai_api/main.py", line 50, in __init__
    self.cookies = self.get_cookies()
                   ^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/meta_ai_api/main.py", line 335, in get_cookies
    fb_session = get_fb_session(self.fb_email, self.fb_password)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/meta_ai_api/utils.py", line 149, in get_fb_session
    raise FacebookInvalidCredentialsException(
meta_ai_api.exceptions.FacebookInvalidCredentialsException: Was not able to login to Facebook. Please check your credentials. You may also have been rate limited. Try to connect to Facebook manually.

My code just had simple:

from meta_ai_api import MetaAI
ai = MetaAI(fb_email="[email protected]", fb_password="XXXXXXXX")

And I know I am using right email pass combo.

jeremyjpj0916 avatar Aug 12 '24 00:08 jeremyjpj0916

I am also facing the same issue. Is anybody came to know about resolution?

dubeypreetesh avatar Aug 13 '24 17:08 dubeypreetesh

Facebook now seems to be requiring a 2FA on each connection, making the connection fail

Strvm avatar Aug 13 '24 18:08 Strvm

would love to get a workaround for this

asad-awadia avatar Aug 13 '24 20:08 asad-awadia

Hi, I spent some time today and fixed the login mechanism. Please upgrade to the latest version and try again on your end.

pip install meta-ai-api --upgrade

Example usage:

from meta_ai_api import MetaAI

ai = MetaAI(fb_email="EMAIL", fb_password="PASS")
resp = ai.prompt(message="Generate a flying corgi", stream=False)
print(resp)

Results to:

{'message': '\n', 'sources': [], 'media': [{'url': 'https://scontent-sjc3-1.xx.fbcdn.net/o1/v/t0/f1/m340/genai_m4_rva_prn_v3:upload_img_30150162_11_11_2024_15_38_53_839707_7210860893543658686.jpeg?_nc_ht=scontent-sjc3-1.xx.fbcdn.net&_nc_cat=105&ccb=9-4&oh=00_AYDdYcFmk3NE2fvIyRdfa1zplSNNUUKbdsKdY7nFtYMvjA&oe=67348AD2&_nc_sid=5b3566', 'type': 'IMAGE', 'prompt': 'a flying corgi'}, {'url': 'https://scontent-sjc3-1.xx.fbcdn.net/o1/v/t0/f1/m340/genai_m4_rva_ftw_v3:upload_img_80186289_11_11_2024_15_38_53_877200_5339600777371350444.jpeg?_nc_ht=scontent-sjc3-1.xx.fbcdn.net&_nc_cat=108&ccb=9-4&oh=00_AYCjw3uIocVsooGRlB6N27QYGQK93WlyaBCS5fhiShwTtA&oe=67346269&_nc_sid=5b3566', 'type': 'IMAGE', 'prompt': 'a flying corgi'}, {'url': 'https://scontent-sjc3-1.xx.fbcdn.net/o1/v/t0/f1/m340/genai_m4_rva_frc_v3:upload_img_1123599_11_11_2024_15_38_53_891297_2220685283103798415.jpeg?_nc_ht=scontent-sjc3-1.xx.fbcdn.net&_nc_cat=108&ccb=9-4&oh=00_AYAb7QbUyaTye_HxF0V1qz9yK5_1f-_cYSeERSKVs4h0OQ&oe=673479BE&_nc_sid=5b3566', 'type': 'IMAGE', 'prompt': 'a flying corgi'}, {'url': 'https://scontent-sjc3-1.xx.fbcdn.net/o1/v/t0/f1/m340/genai_m4_ncg_odn_v3:upload_img_438087_11_11_2024_15_38_53_922254_6380853868722563899.jpeg?_nc_ht=scontent-sjc3-1.xx.fbcdn.net&_nc_cat=108&ccb=9-4&oh=00_AYByFV4a_fjrPeHX8lcs2EyhGP4X4NQByFO7LYFh-I_63A&oe=67348268&_nc_sid=5b3566', 'type': 'IMAGE', 'prompt': 'a flying corgi'}]}

Flying Corgi

Strvm avatar Nov 11 '24 23:11 Strvm

Still facing the same issue after upgrade to 1.2.5 version.

meta_ai_api.exceptions.FacebookInvalidCredentialsException: Was not able to login to Facebook. Please check your credentials. You may also have been rate limited. Try to connect to Facebook manually.

dubeypreetesh avatar Nov 12 '24 08:11 dubeypreetesh

Still facing the same issue after upgrade to 1.2.5 version.

meta_ai_api.exceptions.FacebookInvalidCredentialsException: Was not able to login to Facebook. Please check your credentials. You may also have been rate limited. Try to connect to Facebook manually.

Hi, are you able to use the package without auth?

Strvm avatar Nov 12 '24 17:11 Strvm

ai = MetaAI(fb_email="EMAIL", fb_password="PASS")
resp = ai.prompt(message="Generate a flying corgi", stream=False)
print(resp)

Still facing the same issue after upgrade to 1.2.5 version. meta_ai_api.exceptions.FacebookInvalidCredentialsException: Was not able to login to Facebook. Please check your credentials. You may also have been rate limited. Try to connect to Facebook manually.

Hi, are you able to use the package without auth?

I just upgraded the package using pip and tried to run simple example you mentioned in comment. What does exactly meant by "package without auth" ? FB Email/Password I am providing to create MetaAI class object.

dubeypreetesh avatar Nov 13 '24 08:11 dubeypreetesh

ai = MetaAI(fb_email="EMAIL", fb_password="PASS")
resp = ai.prompt(message="How are you", stream=False)

Traceback (most recent call last):

File "E:\Softwares\Laragon\laragon\www\Ai-projects\meta-ai-api\src\meta_ai_api\main.py", line 46, in init self.cookies = self.get_cookies() File "E:\Softwares\Laragon\laragon\www\Ai-projects\meta-ai-api\src\meta_ai_api\main.py", line 313, in get_cookies fb_session = get_fb_session(self.fb_email, self.fb_password) File "E:\Softwares\Laragon\laragon\www\Ai-projects\meta-ai-api\src\meta_ai_api\utils.py", line 240, in get_fb_session raise FacebookInvalidCredentialsException( exceptions.FacebookInvalidCredentialsException: Was not able to login to Facebook. Please check your credentials. You may also have been rate limited. Try to connect to Facebook manually.

not working I am also doing In the same way

hamzar98980 avatar Nov 22 '24 10:11 hamzar98980