Skip to content
Snippets Groups Projects
Commit 4c63867e authored by Ted Hess's avatar Ted Hess
Browse files

Update GitHub authorization to use token in header instead of query

parent 8ab07b31
No related branches found
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