Swashbuckle.WebApi
Swashbuckle.WebApi copied to clipboard
How to add antiforgery token field in UI that'll be used in headers
trafficstars
I have a few HTTP POST end points that require AntiForgery tokens being attached as a e.g header named RequestVerificationToken.
Sample endpoint:
[HttpPost]
[ValidateAntiForgeryToken]
[Route("[controller]/[action]")]
public async Task<IActionResult> Test([FromBody]Type data)
Whenever I click the Try it out button in swagger UI. I always get 403 forbidden access because it failed at AntiForgery.Validate();
How can I make POST call in swagger UI by passing the AntiForgeryToken?