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