Skip to content

Instantly share code, notes, and snippets.

Created May 24, 2022
What would you like to do?
public class SecurityController : Controller
private readonly IAntiforgery _antiforgery;
public SecurityController(IAntiforgery antiforgery)
_antiforgery = antiforgery;
public IActionResult Get()
var tokens = _antiforgery.GetAndStoreTokens(HttpContext);
return new ObjectResult(new {
token = tokens.RequestToken,
tokenName = tokens.HeaderName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment