mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-11 07:11:04 +01:00
Add a User-Agent header to OAuth requests
Summary: GitHub now requires this: http://developer.github.com/changes/2013-04-24-user-agent-required/ Test Plan: Used GitHub auth to login. Reviewers: btrahan, chad Reviewed By: chad CC: aran Differential Revision: https://secure.phabricator.com/D5787
This commit is contained in:
parent
614dcbb2d9
commit
664fe7ef73
1 changed files with 7 additions and 6 deletions
|
@ -47,12 +47,13 @@ final class PhabricatorOAuthLoginController
|
||||||
$userinfo_uri = (string)$userinfo_uri;
|
$userinfo_uri = (string)$userinfo_uri;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$user_data = HTTPSFuture::loadContent($userinfo_uri);
|
$user_data_request = new HTTPSFuture($userinfo_uri);
|
||||||
if ($user_data === false) {
|
|
||||||
throw new PhabricatorOAuthProviderException(
|
// NOTE: GitHub requires a User-Agent header.
|
||||||
"Request to '{$userinfo_uri}' failed!");
|
$user_data_request->addHeader('User-Agent', 'Phabricator');
|
||||||
}
|
|
||||||
$provider->setUserData($user_data);
|
list($body) = $user_data_request->resolvex();
|
||||||
|
$provider->setUserData($body);
|
||||||
} catch (PhabricatorOAuthProviderException $e) {
|
} catch (PhabricatorOAuthProviderException $e) {
|
||||||
return $this->buildErrorResponse(new PhabricatorOAuthFailureView(), $e);
|
return $this->buildErrorResponse(new PhabricatorOAuthFailureView(), $e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue