You are here

public function OAuth2Storage::getStorageAuthorizationCode in OAuth2 Server 8

Same name and namespace in other branches
  1. 2.0.x src/OAuth2Storage.php \Drupal\oauth2_server\OAuth2Storage::getStorageAuthorizationCode()

Get the authorization code from the entity backend.

Parameters

string $code: The authorization code string.

Return value

\Drupal\oauth2_server\AuthorizationCodeInterface|bool Returns the code or FALSE.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

3 calls to OAuth2Storage::getStorageAuthorizationCode()
OAuth2Storage::expireAuthorizationCode in src/OAuth2Storage.php
Expire authorization code.
OAuth2Storage::getAuthorizationCode in src/OAuth2Storage.php
Get authorization code.
OAuth2Storage::setAuthorizationCode in src/OAuth2Storage.php
Set authorization code.

File

src/OAuth2Storage.php, line 171

Class

OAuth2Storage
Provides Drupal OAuth2 storage for the library.

Namespace

Drupal\oauth2_server

Code

public function getStorageAuthorizationCode($code) {

  /** @var \Drupal\oauth2_server\AuthorizationCodeInterface[] $codes */
  $codes = $this->entityTypeManager
    ->getStorage('oauth2_server_authorization_code')
    ->loadByProperties([
    'code' => $code,
  ]);
  if ($codes) {
    return reset($codes);
  }
  return FALSE;
}