BadCredentialsException

Login rejected the password, or two-factor authentication was required.

The error#

Login error: Wrong password.
Login error: two-factor authentication required.

BadCredentialsException is a subclass of LoginException. The wrong-password line is that class. The two-factor line is TwoFactorAuthRequiredException, also a subclass of LoginException.

If the 2FA request itself fails, the message is one of:

2FA error: {message}
2FA error: "{status}" status.

{message} and {status} are the message and status fields from Instagram's JSON.

What triggers it#

The wrong-password exception is raised when the login response says the password is wrong. TwoFactorAuthRequiredException is raised when that same login says two-factor authentication is required. The 2FA errors are raised when the code you sent does not produce an ok status.

How to confirm#

Print type(e).__name__ and str(e). Wrong password is credentials. two-factor authentication required means the password was accepted far enough to ask for a code.

Fixes#

Use the account's current password. For 2FA, call the library's two-factor login with the code Instagram sent. A checkpoint that is not a code is AbortDownloadException, not this class.

Running many logins from a server tends to move the failure from a wrong password to a checkpoint. Slowing down does not fix a password Instagram has rejected.

SocialScrape#

Instagram profile is GET /v1/instagram/profile. A private account comes back with is_private true. Posts are GET /v1/instagram/profile/posts, and one post is GET /v1/instagram/post.

Failed requests cost 0 credits. New accounts get 100 credits on signup, no card. Codes are on errors.

Questions

Does SocialScrape take my Instagram password?

No. Profile and post requests are logged out.

Which class is the 2FA prompt?

TwoFactorAuthRequiredException. A failed code is BadCredentialsException.