Beispiel #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'));
 }
Beispiel #2
0
 /**
  * {@inheritdoc}
  */
 protected function initialize()
 {
     parent::initialize();
     $this->apiRequestHeaders = ['Authorization' => 'Bearer ' . $this->token('access_token')];
 }
Beispiel #3
0
 /**
  * {@inheritdoc}
  */
 protected function initialize()
 {
     parent::initialize();
     $this->apiRequestParameters = ['api_key' => $this->clientId, 'api_secret' => $this->clientSecret];
 }
Beispiel #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);
 }
Beispiel #5
0
 /**
  * {@inheritdoc}
  */
 protected function getAuthorizeUrl($parameters = [])
 {
     $addtionals = ['duration' => 'temporary'];
     $parameters = array_replace($parameters, (array) $addtionals);
     return parent::getAuthorizeUrl($parameters);
 }
Beispiel #6
0
 /**
  * {@inheritdoc}
  */
 protected function initialize()
 {
     parent::initialize();
     $apiVersion = $this->config->get('api_version') ?: '20120610';
     $this->apiRequestParameters = ['v' => $apiVersion];
 }