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

HELP "400 Bad Request; challenge_required" Can you support the solution? #1765

Open
berkantakyz opened this issue Mar 24, 2024 · 3 comments
Open
Labels
question unconfirmed This issue hasn't been read/confirmed/accepted by an admin

Comments

@berkantakyz
Copy link

berkantakyz commented Mar 24, 2024

GET /api/v1/media/{mediaId}/likers/ - 400 Bad Request; challenge_required

I get the error when the relevant method is called. I think it is related to user security authentication. What should I do? Please can you tell me the solution if you know?

----CODE----

import { IgApiClient } from 'instagram-private-api';

const ig = new IgApiClient();

ig.state.generateDevice("username");

const extractedString: string | undefined = extractStringFromUrl("https://www.instagram.com/p/xxx");
const media_id: string = getMediaIdFromURL(extractedString);

ig.state.proxyUrl = process.env.IG_PROXY;
(async () => {

await ig.simulate.preLoginFlow();
const loggedInUser = await ig.account.login("username", "pass");

const mediaFeed = await ig.media.likers(media_id);

await ig.account.logout();
})();

@berkantakyz berkantakyz added question unconfirmed This issue hasn't been read/confirmed/accepted by an admin labels Mar 24, 2024
@berkantakyz berkantakyz changed the title "400 Bad Request; challenge_required" Can you support the solution? geö HELP "400 Bad Request; challenge_required" Can you support the solution? Mar 24, 2024
@alfa-meta
Copy link

alfa-meta commented Apr 1, 2024

So I have been struggling with the same error this past week. I have found a solution that worked for me, the solution makes some sense but might not work for everyone.

I added a salt to my username when generating a device.
FROM: ig.state.generateDevice(data.username);
TO: ig.state.generateDevice(data.username + "333");

I use this to mimic a device before logging in.

My guess is that it has detected that this "Device" is erroneous for whatever reason rather than this account is a bot.
I could be wrong. Tell me if anyone has tried this and if it works!

@berkantakyz
Copy link
Author

Unfortunately it didn't work for me, the same situation continues. @alfa-meta

@alfa-meta
Copy link

alfa-meta commented Apr 8, 2024

Upon further testing, I have come to a conclusion that when 400 Bad Request; challenge_required occurs Instagram is suspicious of your account. I have only had this happen to one of my "suspicious accounts" (One that was made on the web app instead of a phone). My suggestion is to leave that account alone for a bit and come back in a month or 2.

I find that accounts made with a phone number on a phone is unlikely to be flagged.

I know its not a real solution. But until a hero comes with a better solution that's all that has worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question unconfirmed This issue hasn't been read/confirmed/accepted by an admin
Projects
None yet
Development

No branches or pull requests

2 participants