instagram-user-feed icon indicating copy to clipboard operation
instagram-user-feed copied to clipboard

Trying login but always return response "Unable to extract JSON data"

Open sportakal opened this issue 1 year ago • 12 comments

Version(s) affected: 6.16

Description
When I try to login with Instagram::withCredentials() and ->login() method with username and password, I keep getting this error "Unable to extract JSON data". Everything was working fine yesterday, today it suddenly started giving this error constantly.

How to reproduce

$instagram = Instagram::withCredentials(
            new \GuzzleHttp\Client(array_merge([
                'verify' => false,
            ])), $this->account->username, $this->account->password, $this->cache_manager
        );

        $instagram = $instagram->login();

Possible Solution
The error occurs at here, Instagram\Auth\Login.php içerisinde, preg_match('/<script type="text\/javascript">window\._sharedData\s?=(.+);<\/script>/', $html, $matches);

This function, makes a request to https://instagram.com to get initial cookies. When i make a request to https://instagram.com via postman, i didn't find any tag that is

I think there is something changed on instagram. Has anyone encountered this problem?

sportakal avatar Oct 21 '22 16:10 sportakal