Open berkantakyz opened 4 months ago
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!
Unfortunately it didn't work for me, the same situation continues. @alfa-meta
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.
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.
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.
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
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(); })();