コード例 #1
0
 /**
  * Get the Oauth Access Token of a user from callback code
  *
  * @param string $code - Oauth2 Code returned with callback url after successfull login
  *
  * @return InstagramOAuth
  */
 public function oauth($code)
 {
     $options = ['grant_type' => 'authorization_code', 'client_id' => $this->app->getId(), 'client_secret' => $this->app->getSecret(), 'redirect_uri' => $this->getCallbackUrl(), 'code' => $code, 'state' => $this->state];
     $response = HelperFactory::getInstance()->request($this->client, Constants::API_TOKEN, $options, 'POST');
     $this->oauthResponse = new InstagramOAuth(json_decode($response->getBody()->getContents()));
     return $this->oauthResponse;
 }