ryldz07 / mgp25

İnstagram mgp25 php api
Other
86 stars 82 forks source link

problem with login. #7

Open noxzemart opened 3 years ago

noxzemart commented 3 years ago

Hello

I have problem with login. when I try to login


 $ig = new \InstInstagramAPI\Instagramagram($debug, $truncatedDebug);

        try {
            $ig->login($username, $password);
        } catch (\Exception $e) {
            echo 'Something went wrong: '.$e->getMessage()."\n";
            exit(0);
        }

I alway get this error.

{"message":"error logging attribution","status":"fail"} Something went wrong: InstagramAPI\Response\GenericResponse: Error logging attribution.

RFatBadger commented 3 years ago

This code not supported for a long time. Seems instagram changed something in API.

But to be able to login, you could comment line that fails.

File mgp25\instagram-php\src\Instagram.php line 958: //$this->internal->logAttribution();

 /**
     * Sends pre-login flow. This is required to emulate real device behavior.
     *
     * @throws \InstagramAPI\Exception\InstagramException
     */
    protected function _sendPreLoginFlow()
    {
        // Reset zero rating rewrite rules.
        $this->client->zeroRating()->reset();
        // Calling this non-token API will put a csrftoken in our cookie
        // jar. We must do this before any functions that require a token.
        $this->internal->fetchZeroRatingToken();
        $this->internal->bootstrapMsisdnHeader();
        $this->internal->readMsisdnHeader('default');
        $this->internal->syncDeviceFeatures(true);
        $launcherResponse = $this->internal->sendLauncherSync(true)->getHttpResponse();
        $this->settings->set('public_key', $launcherResponse->getHeaderLine('ig-set-password-encryption-pub-key'));
        $this->settings->set('public_key_id', $launcherResponse->getHeaderLine('ig-set-password-encryption-key-id'));
        $this->internal->bootstrapMsisdnHeader();
        //$this->internal->logAttribution();
        $this->account->getPrefillCandidates();
        $this->internal->readMsisdnHeader('default', true);
        $this->account->setContactPointPrefill('prefill');
        $this->internal->sendLauncherSync(true, true, true);
        $this->internal->syncDeviceFeatures(true, true);
    }