Skip to content

Commit

Permalink
Merge pull request #45 from glena/master
Browse files Browse the repository at this point in the history
Added optional extra headers to getAccessToken
  • Loading branch information
adoy committed Jul 5, 2015
2 parents 8b39849 + 3b8aef0 commit 0e035fd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/OAuth2/Client.php
Expand Up @@ -205,9 +205,10 @@ public function getAuthenticationUrl($auth_endpoint, $redirect_uri, array $extra
* @param string $token_endpoint Url of the token endpoint
* @param int $grant_type Grant Type ('authorization_code', 'password', 'client_credentials', 'refresh_token', or a custom code (@see GrantType Classes)
* @param array $parameters Array sent to the server (depend on which grant type you're using)
* @param array $extra_headers Array of extra headers
* @return array Array of parameters required by the grant_type (CF SPEC)
*/
public function getAccessToken($token_endpoint, $grant_type, array $parameters)
public function getAccessToken($token_endpoint, $grant_type, array $parameters, array $extra_headers = array())
{
if (!$grant_type) {
throw new InvalidArgumentException('The grant_type is mandatory.', InvalidArgumentException::INVALID_GRANT_TYPE);
Expand All @@ -223,7 +224,7 @@ public function getAccessToken($token_endpoint, $grant_type, array $parameters)
throw new Exception('Unknown constant GRANT_TYPE for class ' . $grantTypeClassName, Exception::GRANT_TYPE_ERROR);
}
$parameters['grant_type'] = $grantTypeClass::GRANT_TYPE;
$http_headers = array();
$http_headers = $extra_headers;
switch ($this->client_auth) {
case self::AUTH_TYPE_URI:
case self::AUTH_TYPE_FORM:
Expand Down Expand Up @@ -292,7 +293,7 @@ public function setCurlOption($option, $value)
* @param array $options An array specifying which options to set and their values
* @return void
*/
public function setCurlOptions($options)
public function setCurlOptions($options)
{
$this->curl_options = array_merge($this->curl_options, $options);
}
Expand Down

0 comments on commit 0e035fd

Please sign in to comment.