Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/provider/PhabricatorOAuth2AuthProvider.php
Show First 20 Lines • Show All 193 Lines • ▼ Show 20 Lines | protected function synchronizeOAuthAccount( | ||||
$expires = $adapter->getAccessTokenExpires(); | $expires = $adapter->getAccessTokenExpires(); | ||||
$account->setProperty('oauth.token.access.expires', $expires); | $account->setProperty('oauth.token.access.expires', $expires); | ||||
} | } | ||||
public function getOAuthAccessToken( | public function getOAuthAccessToken( | ||||
PhabricatorExternalAccount $account, | PhabricatorExternalAccount $account, | ||||
$force_refresh = false) { | $force_refresh = false) { | ||||
if ($account->getProviderKey() !== $this->getProviderKey()) { | if ($account->getProviderConfigPHID() !== $this->getProviderConfigPHID()) { | ||||
throw new Exception(pht('Account does not match provider!')); | throw new Exception(pht('Account does not match provider!')); | ||||
} | } | ||||
if (!$force_refresh) { | if (!$force_refresh) { | ||||
$access_expires = $account->getProperty('oauth.token.access.expires'); | $access_expires = $account->getProperty('oauth.token.access.expires'); | ||||
$access_token = $account->getProperty('oauth.token.access'); | $access_token = $account->getProperty('oauth.token.access'); | ||||
// Don't return a token with fewer than this many seconds remaining until | // Don't return a token with fewer than this many seconds remaining until | ||||
▲ Show 20 Lines • Show All 81 Lines • Show Last 20 Lines |