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

Recover from a broken external OAuth2 account

Summary: Currently, the external accounts page can die in a fire if an OAuth2 link is bad. Instead of exploding, just fail the specific link.

Test Plan: Faked an error and got "invalid token" instead of an exception.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

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

+13 -2
+13 -2
src/applications/auth/provider/PhabricatorAuthProviderOAuth2.php
··· 239 239 PHUIObjectItemView $item, 240 240 PhabricatorExternalAccount $account) { 241 241 242 - // Get a valid token, possibly refreshing it. 243 - $oauth_token = $this->getOAuthAccessToken($account); 242 + // Get a valid token, possibly refreshing it. If we're unable to refresh 243 + // it, render a message to that effect. The user may be able to repair the 244 + // link by manually reconnecting. 245 + 246 + $is_invalid = false; 247 + try { 248 + $oauth_token = $this->getOAuthAccessToken($account); 249 + } catch (Exception $ex) { 250 + $oauth_token = null; 251 + $is_invalid = true; 252 + } 244 253 245 254 $item->addAttribute(pht('OAuth2 Account')); 246 255 ··· 256 265 pht( 257 266 'Active OAuth Token')); 258 267 } 268 + } else if ($is_invalid) { 269 + $item->addAttribute(pht('Invalid OAuth Access Token')); 259 270 } else { 260 271 $item->addAttribute(pht('No OAuth Access Token')); 261 272 }