connection_id = $connection_id; $this->client_id = $client_id; $this->client_secret = $client_secret; $this->refresh_token = $refresh_token; $this->scopes = $scopes; } /** * {@inheritDoc} * * @return string */ public function id() { return 'oauth:' . $this->connection_id . ':' . substr( hash( 'sha256', $this->refresh_token ), 0, 12 ); } /** * {@inheritDoc} * * @param string $scope Scope URL. * @return bool */ public function supports( $scope ) { return in_array( $scope, $this->scopes, true ); } /** * {@inheritDoc} * * @return void */ public function revoke() { OAuthClient::revoke( $this->refresh_token ); $this->forget_token(); } /** * {@inheritDoc} * * @return array */ protected function request_token() { return OAuthClient::refresh( $this->client_id, $this->client_secret, $this->refresh_token ); } }