You are here

public function RefreshToken::getGrantType in Simple OAuth (OAuth2) & OpenID Connect 8.4

Same name and namespace in other branches
  1. 5.x src/Plugin/Oauth2Grant/RefreshToken.php \Drupal\simple_oauth\Plugin\Oauth2Grant\RefreshToken::getGrantType()

Gets the grant object.

Return value

League\OAuth2\Server\Grant\GrantTypeInterface The grant type.

Overrides Oauth2GrantInterface::getGrantType

File

src/Plugin/Oauth2Grant/RefreshToken.php, line 60

Class

RefreshToken
The refresh token grant plugin.

Namespace

Drupal\simple_oauth\Plugin\Oauth2Grant

Code

public function getGrantType() {
  $grant = new RefreshTokenGrant($this->refreshTokenRepository);
  $settings = $this->configFactory
    ->get('simple_oauth.settings');
  $grant
    ->setRefreshTokenTTL(new \DateInterval(sprintf('PT%dS', $settings
    ->get('refresh_token_expiration'))));
  return $grant;
}