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: Fixed IG Accounts without a Facebook account failing login due to 400 Bad Request #1752

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

qsenn35
Copy link

@qsenn35 qsenn35 commented Jan 25, 2024

File changed: repositories/account.repository.js:19

Previously with the endpoint /api/v1/accounts/login Instagram accounts not associated with a Facebook account would receive this error:

400 Bad Request; The username you entered doesn't appear to belong to an account. Please check your username and try again.

After looking at the network logs of Instagram I decided to try switching the endpoint to /api/v1/web/accounts/login/ajax/ and that seemed to do the trick. Also tested that the new endpoint is compatible with Instagram accounts that have Facebook connections.

EDIT: I added a commit to convert the 2FA function in the account repository to use the web API as well. Seems like there's some security check to make sure the login and 2fa requests come from the same platform. Also, if the user doesn't have a facebook account associated with their Instagram account, I don't think SMS will work here. I had to use an authenticator app to 2FA. Should we add this to the documentation?

Question, for some reason the twoFactorLogin function hangs sometimes, but it still does a successful 2FA as my next login is trusted. Confused on why this happens and hoping we can get some clarity on why so this PR can be merged.
^ Disregard, issue with my express route.

@PineAppleGrits
Copy link

const auth = await ig.account.login(process.env.IG_USERNAME!, process.env.IG_PASSWORD!);
console.log(auth)

Im getting undefined when loggin in with valid credentials. Am i the only one getting this ?

@qsenn35
Copy link
Author

qsenn35 commented Feb 12, 2024

Hmm, i this with an account that is tied with Facebook or isn't? The change I PR'd was the only way I could make non-facebook tied accounts to work, and I did a basic test for Facebook tied accounts and saw no issues on my end.

I'll take a look at this once I'm home.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants