diff --git a/src/Grant/AuthCodeGrant.php b/src/Grant/AuthCodeGrant.php index d6411237..acd2f381 100644 --- a/src/Grant/AuthCodeGrant.php +++ b/src/Grant/AuthCodeGrant.php @@ -273,7 +273,8 @@ class AuthCodeGrant extends AbstractGrant // Generate the access token $accessToken = new AccessTokenEntity($this->server); $accessToken->setIdentifier(SecureKey::generate()); - $accessToken->setExpiryDateTime((new \DateTime)->add($accessTokenTTL)); + $expirationDateTime = (new \DateTime())->add($accessTokenTTL); + $accessToken->setExpiryDateTime($expirationDateTime); $accessToken->setClient($client); foreach ($code->getScopes() as $scope) { diff --git a/src/Grant/ClientCredentialsGrant.php b/src/Grant/ClientCredentialsGrant.php index 39cab779..50be9a1f 100644 --- a/src/Grant/ClientCredentialsGrant.php +++ b/src/Grant/ClientCredentialsGrant.php @@ -82,7 +82,8 @@ class ClientCredentialsGrant extends AbstractGrant // Generate an access token $accessToken = new AccessTokenEntity(); $accessToken->setIdentifier(SecureKey::generate()); - $accessToken->setExpiryDateTime((new \DateTime())->add($accessTokenTTL)); + $expirationDateTime = (new \DateTime())->add($accessTokenTTL); + $accessToken->setExpiryDateTime($expirationDateTime); $accessToken->setClient($client); $accessToken->setOwner('client', $client->getIdentifier()); diff --git a/src/Grant/PasswordGrant.php b/src/Grant/PasswordGrant.php index c29c867c..e50f4708 100644 --- a/src/Grant/PasswordGrant.php +++ b/src/Grant/PasswordGrant.php @@ -147,7 +147,8 @@ class PasswordGrant extends AbstractGrant // Generate an access token $accessToken = new AccessTokenEntity(); $accessToken->setIdentifier(SecureKey::generate()); - $accessToken->setExpiryDateTime((new \DateTime())->add($accessTokenTTL)); + $expirationDateTime = (new \DateTime())->add($accessTokenTTL); + $accessToken->setExpiryDateTime($expirationDateTime); $accessToken->setOwner('user', $user->getIdentifier()); $accessToken->setClient($client);