pgrimaud / instagram-user-feed

This is a scrapper to easily fetch any feed and interact with Instagram (like, follow, etc.) without OAuth for PHP.
MIT License
880 stars 137 forks source link

https://www.instagram.com/accounts/login/ajax/` resulted in a `400 Bad Request` #69

Closed gtapps closed 4 years ago

gtapps commented 4 years ago

Hello! Thank you for the great package and the new version, just wanted to report an issue and try to find a way to solve it....

[2020-05-27 04:54:53] local.ERROR: Unknown error (Client error: POST https://www.instagram.com/accounts/login/ajax/ resulted in a 400 Bad Request response: {"message": "checkpoint_required", "checkpoint_url": "/challenge/30042500215/k3S5qtvcLg/", "lock": false, "status": "fai (truncated...) ). Please report it with a GitHub issue. {"exception":"[object] (Instagram\Exception\InstagramAuthException(code: 0): Unknown error (Client error: POST https://www.instagram.com/accounts/login/ajax/ resulted in a 400 Bad Request response: {\"message\": \"checkpoint_required\", \"checkpoint_url\": \"/challenge/30042500215/k3S5qtvcLg/\", \"lock\": false, \"status\": \"fai (truncated...)

I believe this is caused because of now the package requires you to login to use it, and because I'm using proxies, I believe it's what is causing this error 400(after the ajax request using a proxy if I refresh IG, it asks me if it was me who logged in from proxy country).

Any idea on how to solve it?

Thanks for the amazing package.

pgrimaud commented 4 years ago

Hello @gtapps

Could you create a new Instagram dummy account and retry?

pgrimaud commented 4 years ago

Oh sorry, I miss this :

I believe this is caused because of now the package requires you to login to use it, and because I'm using proxies, I believe it's what is causing this error 400(after the ajax request using a proxy if I refresh IG, it asks me if it was me who logged in from proxy country).

I will try to find a way to bypass this challenge.

ref to https://github.com/postaddictme/instagram-php-scraper/issues/676

pareshsojitra commented 4 years ago

checkpoint_required When you get this error it means instagram ask to pass the challenge.

Simply login to instagram it will ask you to allow and then allow it for first time, then it will work normal.

You must have Version ^6.0

Thank you.

NicAA1 commented 4 years ago

Simply login to instagram it will ask you to allow and then allow it for first time, then it will work normal.

unfortunately not. I'm getting the same error (400 bad request --> checkpoint required) over and over again. I'm having absolutely no trouble on my local machine, but the production environment is a pretty bad shared webspace...

pgrimaud commented 4 years ago

I developed a Proof of Concept to bypass this error.

How it works :

  1. Try to login
  2. Got 400 error "checkpoint_required"
  3. Trigger email verification
  4. Connect to your email inbox using IMAP
  5. Wait for Instagram verification email
  6. Parse verification code from email
  7. Make a request to instagram with this code to complete verification
  8. Verification is done, then save session

It works, I pushed the code here : https://github.com/pgrimaud/instagram-user-feed/blob/feature/checkpoint-challenge/src/Instagram/Auth/Login.php

BEWARE : the code is dirty, it was just to try the concept.

I will create a new release in the next days with better code 🔥

danimalweb commented 4 years ago

Looking forward to seeing this released.

pgrimaud commented 4 years ago

Hi, I released the 6.3.0 version.

You can now bypass the checkpoint challenge with the last version. I added a backyard compatibility with 6.x versions (ext-imap is not required in composer.json)

You can find an example here : https://github.com/pgrimaud/instagram-user-feed/blob/master/examples/checkpoint-challenge.php

Please feel free to test it and open a new separated issue if needed. 😄

bytehead commented 4 years ago

Thank you @pgrimaud ❤️

bytehead commented 4 years ago

Works perfectly! 🥇