Пример #1
0
 /**
  * Need to store user_id as token for later use
  *
  * {@inheritdoc}
  */
 protected function validateAccessTokenExchange($response)
 {
     $data = parent::validateAccessTokenExchange($response);
     $this->token('user_id', $data->get('user_id'));
     $this->token('email', $data->get('email'));
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 protected function initialize()
 {
     parent::initialize();
     $this->apiRequestHeaders = ['Authorization' => 'Bearer ' . $this->token('access_token')];
 }
Пример #3
0
 /**
  * {@inheritdoc}
  */
 protected function initialize()
 {
     parent::initialize();
     $this->apiRequestParameters = ['api_key' => $this->clientId, 'api_secret' => $this->clientSecret];
 }
Пример #4
0
 /**
  * Mailru requires extra signature when requesting protected resources
  *
  * Omit session_key from url. parent::apiRequest() will append the access token anyway.
  *
  * {@inheritdoc}
  */
 public function apiRequest($url, $method = 'GET', $parameters = [], $headers = [])
 {
     $signature = md5('client_id=' . $this->clientId . 'format=jsonmethod=' . $url . 'secure=1session_key=' . $this->token('access_token') . $this->clientSecret);
     $url = 'format=json&client_id=' . $this->clientId . '&method=' . $url . '&secure=1&sig=' . $signature;
     return parent::apiRequest($url, $method, $parameters, $headers);
 }
Пример #5
0
 /**
  * {@inheritdoc}
  */
 protected function getAuthorizeUrl($parameters = [])
 {
     $addtionals = ['duration' => 'temporary'];
     $parameters = array_replace($parameters, (array) $addtionals);
     return parent::getAuthorizeUrl($parameters);
 }
Пример #6
0
 /**
  * {@inheritdoc}
  */
 protected function initialize()
 {
     parent::initialize();
     $apiVersion = $this->config->get('api_version') ?: '20120610';
     $this->apiRequestParameters = ['v' => $apiVersion];
 }