Skip to content
Snippets Groups Projects
Unverified Commit 6f6b1731 authored by Andreas Gohr's avatar Andreas Gohr Committed by GitHub
Browse files

Merge pull request #90 from thess/github-auth-token

Update GitHub authorization to use token in header instead of query
parents 8ab07b31 4c63867e
Branches
No related tags found
No related merge requests found
......@@ -167,6 +167,8 @@ abstract class AbstractService extends BaseAbstractService implements ServiceInt
$uri->addToQuery('apikey', $token->getAccessToken());
} elseif (static::AUTHORIZATION_METHOD_HEADER_BEARER === $this->getAuthorizationMethod()) {
$extraHeaders = array_merge(array('Authorization' => 'Bearer ' . $token->getAccessToken()), $extraHeaders);
} elseif (static::AUTHORIZATION_METHOD_HEADER_TOKEN === $this->getAuthorizationMethod()) {
$extraHeaders = array_merge(array('Authorization' => 'token ' . $token->getAccessToken()), $extraHeaders);
}
$extraHeaders = array_merge($this->getExtraApiHeaders(), $extraHeaders);
......
......@@ -122,7 +122,7 @@ class GitHub extends AbstractService
*/
protected function getAuthorizationMethod()
{
return static::AUTHORIZATION_METHOD_QUERY_STRING;
return static::AUTHORIZATION_METHOD_HEADER_TOKEN;
}
/**
......
......@@ -23,6 +23,7 @@ interface ServiceInterface extends BaseServiceInterface
const AUTHORIZATION_METHOD_QUERY_STRING = 2;
const AUTHORIZATION_METHOD_QUERY_STRING_V2 = 3;
const AUTHORIZATION_METHOD_QUERY_STRING_V3 = 4;
const AUTHORIZATION_METHOD_HEADER_TOKEN = 5;
/**
* Retrieves and stores/returns the OAuth2 access token after a successful authorization.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment