protected function HttpClientOAuth2::setAccessToken in Http Client 7.2
Set the access_token to the request.
1 call to HttpClientOAuth2::setAccessToken()
- HttpClientOAuth2::authenticate in includes/
auth/ oauth2/ HttpClientOAuth2.inc - Gets an access_token from the oauth2 client and sets it to the $request.
File
- includes/
auth/ oauth2/ HttpClientOAuth2.inc, line 54
Class
Code
protected function setAccessToken(&$request, $access_token) {
$access_token_on_query = isset($this->settings['query_auth']) ? $this->settings['query_auth'] : FALSE;
if ($access_token_on_query) {
// Send the access token in the query string.
$request->parameters['access_token'] = $access_token;
}
else {
// Send the access token in the 'Authorization' header.
$request
->setHeader('Authorization', 'Bearer ' . $access_token);
}
}