
- Item Details
- FAQs
- Support
- Reviews
- Find this file /app/vendor/mgp25/instagram-php/src/Instagram.php
- Modify finishChallengeLogin() function look like that:
** * Finish a challenge login * *
This function finishes a checkpoint challenge that was provided by the * sendChallangeCode method. If you successfully answer their challenge, * you will be logged in after this function call. * * @param string $username Instagram username. * @param string $password Instagram password. * @param string $apiPath Relative path to the api endpoint * for the challenge. * @param string $securityCode Verification code you have received * via SMS or Email. * @param integer $appRefreshInterval See `login()` for description of this * parameter. * * @throws \InvalidArgumentException * @throws \InstagramAPI\Exception\InstagramException * * @return \InstagramAPI\Response\LoginResponse */public function finishChallengeLogin( $username, $password, $apiPath, $securityCode, $appRefreshInterval = 1800, $usernameHandler = null) { if (empty($username) || empty($password)) { throw new \InvalidArgumentException('You must provide a username and password to finishChallengeLogin().'); } if (empty($apiPath) || empty($securityCode)) { throw new \InvalidArgumentException('You must provide a api path and security code to finishChallengeLogin().'); } // Remove all whitespace from the verification code. $securityCode = preg_replace('/\s+/', '', $securityCode); // Switch the currently active user/pass if the details are different. // NOTE: The username and password AREN'T actually necessary for THIS // endpoint, but this extra step helps people who statelessly embed the // library directly into a webpage, so they can `finishTwoFactorLogin()` // on their second page load without having to begin any new `login()` // call (since they did that in their previous webpage's library calls). if ($this->username !== $username || $this->password !== $password) { $this->_setUser($username, $password); } $username = ($usernameHandler !== null) ? $usernameHandler : $username; $this->_sendPreLoginFlow(); $response = $this->request(ltrim($apiPath, "/")) ->setNeedsAuth(false) ->addPost('security_code', $securityCode) ->addPost('_csrftoken', $this->client->getToken()) ->addPost('username', $username) ->addPost('guid', $this->uuid) ->addPost('device_id', $this->device_id) ->getResponse(new Response\LoginResponse()); if (!$response->hasResponse()) { throw new \Exception('Invalid Login Response at finishChallengeLogin().'); } $this->_updateLoginState($response); $this->_sendLoginFlow(true, $appRefreshInterval); return $response;}