Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Two factor authentication not working anymore, "Invalid parameters" #1906

Open
vltclz opened this issue May 1, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@vltclz
Copy link
Contributor

vltclz commented May 1, 2024

When using two factor authentication with the verification_code parameter on the client.login() function, it now raises Invalid parameters error. Most probably there is something wrong with this data object that Instagram doesn't like anymore... :

# ...
data = {
    "verification_code": verification_code,
    "phone_id": self.phone_id,
    "_csrftoken": self.token,
    "two_factor_identifier": two_factor_identifier,
    "username": username,
    "trust_this_device": "0",
    "guid": self.uuid,
    "device_id": self.android_device_id,
    "waterfall_id": str(uuid4()),
    "verification_method": "3",
}
# ...

Here is the traceback for context

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/instagrapi/instagrapi/mixins/private.py", line 359, in _send_private_request
    response.raise_for_status()
  File "/home/myproject/.venv/lib/python3.10/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://i.instagram.com/api/v1/accounts/login/

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/instagrapi/instagrapi/mixins/auth.py", line 441, in login
    logged = self.private_request("accounts/login/", data, login=True)
  File "/home/instagrapi/instagrapi/mixins/private.py", line 541, in private_request
    raise e
  File "/home/instagrapi/instagrapi/mixins/private.py", line 526, in private_request
    self._send_private_request(endpoint, **kwargs)
  File "/home/instagrapi/instagrapi/mixins/private.py", line 419, in _send_private_request
    raise TwoFactorRequired(**last_json)
instagrapi.exceptions.TwoFactorRequired: Two-factor authentication required

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/instagrapi/instagrapi/mixins/private.py", line 359, in _send_private_request
    response.raise_for_status()
  File "/home/myproject/.venv/lib/python3.10/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://i.instagram.com/api/v1/accounts/two_factor_login/

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/myproject/bot.py", line 279, in handle_account_tasks_exceptions
    raise e
  File "/home/myproject/bot.py", line 241, in handle_account_tasks_exceptions
    acc.log_back_in()
  File "/home/myproject/account/account.py", line 133, in log_back_in
    self.client.login(
  File "/home/instagrapi/instagrapi/mixins/auth.py", line 465, in login
    logged = self.private_request(
  File "/home/instagrapi/instagrapi/mixins/private.py", line 541, in private_request
    raise e
  File "/home/instagrapi/instagrapi/mixins/private.py", line 526, in private_request
    self._send_private_request(endpoint, **kwargs)
  File "/home/instagrapi/instagrapi/mixins/private.py", line 448, in _send_private_request
    raise UnknownError(**last_json)
instagrapi.exceptions.UnknownError: Invalid Parameters

However, it might be a temporary issue from Instagram, as it seems a lot of normal users with 2FA are having the same problem : https://www.reddit.com/r/Instagram/comments/1ch6udm/cant_login_to_instagram/

@vltclz vltclz added the bug Something isn't working label May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant