mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 14:00:56 +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;
|
||||
|
||||
try {
|
||||
$user_data = HTTPSFuture::loadContent($userinfo_uri);
|
||||
if ($user_data === false) {
|
||||
throw new PhabricatorOAuthProviderException(
|
||||
"Request to '{$userinfo_uri}' failed!");
|
||||
}
|
||||
$provider->setUserData($user_data);
|
||||
$user_data_request = new HTTPSFuture($userinfo_uri);
|
||||
|
||||
// NOTE: GitHub requires a User-Agent header.
|
||||
$user_data_request->addHeader('User-Agent', 'Phabricator');
|
||||
|
||||
list($body) = $user_data_request->resolvex();
|
||||
$provider->setUserData($body);
|
||||
} catch (PhabricatorOAuthProviderException $e) {
|
||||
return $this->buildErrorResponse(new PhabricatorOAuthFailureView(), $e);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue