@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.

Read both email addresses and Google Account IDs from Google OAuth

Summary:
Ref T13493. Google returns a lower-quality account identifier ("email") and a higher-quality account identifier ("id"). We currently read only "email".

Change the logic to read both "email" and "id", so that if Google ever moves away from "email" the transition will be a bit easier.

Test Plan: Linked/unlinked a Google account, looked at the external account identifier table.

Maniphest Tasks: T13493

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

+17 -9
+17 -2
src/applications/auth/adapter/PhutilGoogleAuthAdapter.php
··· 13 13 return 'google.com'; 14 14 } 15 15 16 - public function getAccountID() { 17 - return $this->getAccountEmail(); 16 + protected function newAccountIdentifiers() { 17 + $identifiers = array(); 18 + 19 + $account_id = $this->getOAuthAccountData('id'); 20 + if ($account_id !== null) { 21 + $account_id = sprintf( 22 + 'id(%s)', 23 + $account_id); 24 + $identifiers[] = $this->newAccountIdentifier($account_id); 25 + } 26 + 27 + $email = $this->getAccountEmail(); 28 + if ($email !== null) { 29 + $identifiers[] = $this->newAccountIdentifier($email); 30 + } 31 + 32 + return $identifiers; 18 33 } 19 34 20 35 public function getAccountEmail() {
-7
src/applications/auth/provider/PhabricatorAuthProvider.php
··· 204 204 get_class($this))); 205 205 } 206 206 207 - if (count($identifiers) !== 1) { 208 - throw new Exception( 209 - pht( 210 - 'Unexpected number of account identifiers returned (by class "%s").', 211 - get_class($this))); 212 - } 213 - 214 207 $config = $this->getProviderConfig(); 215 208 $viewer = PhabricatorUser::getOmnipotentUser(); 216 209