You are here

public function AccessTokenManager::getAccessTokens in Access unpublished 8

Obtains all access tokens.

Parameters

string $status: Status of the token. Possible values are 'active' and 'expired'. No parameter will return all tokens.

Return value

AccessTokenInterface[] The access tokens.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

File

src/AccessTokenManager.php, line 92

Class

AccessTokenManager
Service to work with access tokens.

Namespace

Drupal\access_unpublished

Code

public function getAccessTokens($status = NULL) {
  $tokens = $this
    ->buildAccessTokenQuery($status)
    ->execute();
  return $this->entityTypeManager
    ->getStorage('access_token')
    ->loadMultiple($tokens);
}