You are here

protected function OAuth2Storage::logAccessTime in OAuth2 Server 8

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

Track the time the token was accessed.

Parameters

\Drupal\oauth2_server\TokenInterface $token: A token object.

1 call to OAuth2Storage::logAccessTime()
OAuth2Storage::getAccessToken in src/OAuth2Storage.php
Get access token.

File

src/OAuth2Storage.php, line 371

Class

OAuth2Storage
Provides Drupal OAuth2 storage for the library.

Namespace

Drupal\oauth2_server

Code

protected function logAccessTime(TokenInterface $token) {
  if (empty($token->last_access->value) || $token->last_access->value != $this->time
    ->getRequestTime()) {
    $token->last_access = $this->time
      ->getRequestTime();
    try {
      $token
        ->save();
    } catch (\Exception $e) {

      // @todo find a way to reliably handle concurrent updates of last_access.
    }
  }
}