Nonce

New in version 12.4

The nonce request attribute is related to Content security policy.

It is available in backend and frontend context, if the according feature is enabled:

One can retrieve the nonce like this:

// use TYPO3\CMS\Core\Domain\ConsumableString

/** @var ConsumableString|null $nonce */
$nonceAttribute = $this->request->getAttribute('nonce');
if ($nonceAttribute instanceof ConsumableString) {
    $nonce = $nonceAttribute->consume();
}
Copied!