@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Upgrade to GitHub v3 API

Summary: GitHub dropped support for the v2 API today, which breaks login and registration. Use the v3 API instead.

Test Plan: Registered and logged in with GitHub. Verified process pulled email/photo/name/username correctly.

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D2726

+10 -6
+5
src/applications/auth/controller/PhabricatorOAuthLoginController.php
··· 60 60 61 61 $userinfo_uri = new PhutilURI($provider->getUserInfoURI()); 62 62 $userinfo_uri->setQueryParam('access_token', $this->accessToken); 63 + $userinfo_uri = (string)$userinfo_uri; 63 64 64 65 try { 65 66 $user_data = @file_get_contents($userinfo_uri); 67 + if ($user_data === false) { 68 + throw new PhabricatorOAuthProviderException( 69 + "Request to '{$userinfo_uri}' failed!"); 70 + } 66 71 $provider->setUserData($user_data); 67 72 } catch (PhabricatorOAuthProviderException $e) { 68 73 return $this->buildErrorResponse(new PhabricatorOAuthFailureView());
+5 -6
src/applications/auth/oauth/provider/PhabricatorOAuthProviderGitHub.php
··· 71 71 72 72 public function getTestURIs() { 73 73 return array( 74 - 'http://github.com', 74 + 'http://api.github.com', 75 75 ); 76 76 } 77 77 78 78 public function getUserInfoURI() { 79 - return 'https://github.com/api/v2/json/user/show'; 79 + return 'https://api.github.com/user'; 80 80 } 81 81 82 82 public function getMinimumScope() { ··· 84 84 } 85 85 86 86 public function setUserData($data) { 87 - $data = idx(json_decode($data, true), 'user'); 87 + $data = json_decode($data, true); 88 88 $this->validateUserData($data); 89 89 $this->userData = $data; 90 90 return $this; ··· 103 103 } 104 104 105 105 public function retrieveUserProfileImage() { 106 - $id = $this->userData['gravatar_id']; 107 - if ($id) { 108 - $uri = 'http://www.gravatar.com/avatar/'.$id.'?s=50'; 106 + $uri = idx($this->userData, 'avatar_url'); 107 + if ($uri) { 109 108 return @file_get_contents($uri); 110 109 } 111 110 return null;