Nonce
The nonce
request attribute is related to Content Security Policy.
It is always available in backend context and only in 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!