diff --git a/com_oauthserver/site/src/Repository/AccessTokenRepository.php b/com_oauthserver/site/src/Repository/AccessTokenRepository.php index 6b42589..c626911 100644 --- a/com_oauthserver/site/src/Repository/AccessTokenRepository.php +++ b/com_oauthserver/site/src/Repository/AccessTokenRepository.php @@ -42,10 +42,17 @@ class AccessTokenRepository implements AccessTokenRepositoryInterface public function persistNewAccessToken(AccessTokenEntityInterface $accessTokenEntity): void { - /** @var AccessToken $accessTokenEntity */ - $accessToken = $this->accessTokenModel->getItemByIdentifier($accessTokenEntity->getIdentifier()); + $found = false; + try { + /** @var AccessToken $accessTokenEntity */ + $accessToken = $this->accessTokenModel->getItemByIdentifier($accessTokenEntity->getIdentifier()); + if ($accessToken->id > 0) { + $found = true; + } + } catch (\Throwable $e) { + } - if ($accessToken->id > 0) { + if ($found) { throw UniqueTokenIdentifierConstraintViolationException::create(); }