You are here

public function OAuth2Storage::getStorageToken in OAuth2 Server 2.0.x

Same name and namespace in other branches
  1. 8 src/OAuth2Storage.php \Drupal\oauth2_server\OAuth2Storage::getStorageToken()

Get the token from the entity backend.

Parameters

string $token: The token to find.

Return value

\Drupal\oauth2_server\TokenInterface|bool Returns the token or FALSE.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

5 calls to OAuth2Storage::getStorageToken()
OAuth2Storage::getAccessToken in src/OAuth2Storage.php
Get access token.
OAuth2Storage::getRefreshToken in src/OAuth2Storage.php
Get refresh token.
OAuth2Storage::setAccessToken in src/OAuth2Storage.php
Set access token.
OAuth2Storage::setRefreshToken in src/OAuth2Storage.php
Set refresh token.
OAuth2Storage::unsetRefreshToken in src/OAuth2Storage.php
Unset refresh token.

File

src/OAuth2Storage.php, line 149

Class

OAuth2Storage
Provides Drupal OAuth2 storage for the library.

Namespace

Drupal\oauth2_server

Code

public function getStorageToken($token) {

  /** @var \Drupal\oauth2_server\TokenInterface[] $tokens */
  $tokens = $this->entityTypeManager
    ->getStorage('oauth2_server_token')
    ->loadByProperties([
    'token' => $token,
  ]);
  if ($tokens) {
    return reset($tokens);
  }
  return FALSE;
}