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 · 7 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.

@blmalone
Copy link

blmalone commented Jul 2, 2024

I was able to go into the app and press a button saying "This was me trying to login". Seems like it's a precautionary step instagram is taking to stop accounts being hacked.

@ChromeQ
Copy link

ChromeQ commented Jul 3, 2024

This was also happening to me, I logged into my account manually and clicked the "This was me" button. When I ran the script to use this package login then the challenge_required came again and when I refresh the app in the real browser it again comes up, stuck in this loop.

@ChromeQ
Copy link

ChromeQ commented Jul 3, 2024

All I want to do is automatically follow a user (I have the user id) and looking for the "official way" to do this using the Instagram Graph API, seems it cannot be done. Does anyone know a way to do this without resorting to these "web workarounds" which are easily blocked by Instagram

@sunmasters
Copy link

It is easily solve error. But the flow is not available in this library

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

5 participants