Closed naveedumar786 closed 1 year ago
PHP Fatal error: Uncaught InstagramScraper\Exception\InstagramAuthException: Response code is 403: Forbidden.Something went wrong. Please report issue. in C:\Nabi\instagram-php-scraper\vendor\raiym\instagram-php-scraper\src\InstagramScraper\Instagram.php:2229
Stack trace:
#0 C:\Nabi\instagram-php-scraper\save_medias.php(70): InstagramScraper\Instagram->login(true, Object(InstagramScraper\TwoStepVerification\ConsoleVerification))
#1 {main}
thrown in C:\Nabi\instagram-php-scraper\vendor\raiym\instagram-php-scraper\src\InstagramScraper\Instagram.php on line 2229
nstagramScraper\Exception\InstagramAuthException: Response code is 403: Forbidden.Something went wrong. Please report issue. in file C:\.......\back\vendor\raiym\instagram-php-scraper\src\InstagramScraper\Instagram.php on line 2229
username and password is correctly.
nstagramScraper\Exception\InstagramAuthException: Response code is 403: Forbidden.Something went wrong. Please report issue. in file C:\.......\back\vendor\raiym\instagram-php-scraper\src\InstagramScraper\Instagram.php on line 2229
username and password is correctly.
PHP Fatal error: Uncaught InstagramScraper\Exception\InstagramAuthException: Response code is 403: Forbidden.Something went wrong. Please report issue. in /home/....../projects/wineexp-scraper/vendor/raiym/instagram-php-scraper/src/InstagramScraper/Instagram.php:2229 Stack trace:
thrown in /home/........./vendor/raiym/instagram-php-scraper/src/InstagramScraper/Instagram.php on line 2229
i'm having same problem
Same issue here. Xampp and VPN on localhost
I noticed that the following error appears on the web version as well:
CSRF token missing or incorrect
And there is a 403 error in the console:
Request URL: https://www.instagram.com/api/v1/web/accounts/login/ajax/
Request Method: POST
Status Code: 403
{"message":"CSRF token missing or incorrect","status":"fail"}
After a little research I came up with this solution:
Open your chrome browser developer tools then go to the login page of instagram, in the network tab find request that goes like this https://www.instagram.com/ click on the request and in the response tab press
ctrl+f
and search forcsrf_token
, copy the value of csrf go the application tab, in storage section click on cookies and insert a cookie withcsrftoken
name and paste the value and make it secure. now fill the login form and press enter. hope it helps ref: https://stackoverflow.com/a/74372169/1407491
This method works for entering the web version. I think this trick can solve the problem of this package.
I worked on the topic more.
First I noticed in this line:
There is a bug and it should be like this:
preg_match('/\\\\"csrf_token\\\\":\\\\"(.*?)\\\\"/', $response->body, $match);
Then the previous 403 problem was solved.
But this time the problem was with the two-step login, which I noticed that the previous version of Instagram and of course some current challenges still use the window._sharedData...
format:
That the code related to it also exists on the same basis:
But with Instagram's recent changes, its HTML and JS source has been obfuscated and looks like this:
Therefore, there is a need for optimization and correction in this field.
It seems that the issue is still reproduced:
Fatal error: Uncaught InstagramScraper\Exception\InstagramAuthException: Response code is 403: Forbidden.Something went wrong. Please report issue. in /sandbox/instagram/src/InstagramScraper/Instagram.php:2244
Works only with the sessionId, but not with the login and password.
InstagramScraper\Exception\InstagramAuthException Response code is 403: Forbidden.
Unable to find the solution...