src/Security/EventListener/Token/ModifierListener.php
public function created(JWTCreatedEvent $event)
    {
        $data = $event->getData();

        foreach ($this->removed as $property) {
            if (!array_key_exists($property, $data)) {
                throw new OutOfRangeException('Property does not exist.');
            }

            unset($data[$property]);
        }

        $event->setData($data);
    }
public function created(JWTCreatedEvent $event)
    {
        $data = $event->getData();

        foreach ($this->removed as $property) {
            if (!array_key_exists($property, $data)) {
                throw new OutOfRangeException('Property does not exist.');
            }

            unset($data[$property]);
        }

        $event->setData($data);
    }
Modify the jwt token

@param \Lexik\Bundle\JWTAuthenticationBundle\Event\JWTCreatedEvent $event
@throws \OutOfRangeException