public function verifyIdToken($idToken, bool $checkIfRevoked = null, bool $allowTimeInconsistencies = null): Token
    {
        $checkIfRevoked = $checkIfRevoked ?? false;
        $allowTimeInconsistencies = $allowTimeInconsistencies ?? false;

        try {
            $verifiedToken = $this->idTokenVerifier->verifyIdToken($idToken);
        } catch (IssuedInTheFuture $e) {
            if (!$allowTimeInconsistencies) {
                throw $e;
            }

            $verifiedToken = $e->getToken();
        } catch (InvalidToken $e) {
            $verifiedToken = $idToken instanceof Token ? $idToken : (new Parser())->parse($idToken);

            if (stripos($e->getMessage(), 'authentication time') !== false) {
                $authTime = $verifiedToken->getClaim('auth_time', false);

                if ($authTime && !$allowTimeInconsistencies && $authTime > time()) {
                    throw $e;
                }
            } else {
                throw $e;
            }
        }

        if ($checkIfRevoked && $allowTimeInconsistencies) {
            throw new InvalidToken($verifiedToken, 'Allowing mismatching timestamps cannot be combined with token revokation checks.');
        }

        if ($checkIfRevoked) {
            $tokenAuthenticatedAt = DT::toUTCDateTimeImmutable($verifiedToken->getClaim('auth_time'));
            $validSince = $this->getUser($verifiedToken->getClaim('sub'))->tokensValidAfterTime;

            if ($validSince && ($tokenAuthenticatedAt < $validSince)) {
                throw new RevokedIdToken($verifiedToken);
            }
        }

        return $verifiedToken;
    }