Search code examples
2sxc

I need to call 2sxc web api without anti forgery token


Im making an app for some form, and im colleting some not sensitive information.

I need to make an automatic report from a server, calling directly to report to download information, but im not being allowed to make the call because is being enabled automatically with antiforgerytoken, so if I make a get request from the server to a controller/action, im receiving an error, but if I make the call throw $2sxc(XXX).webApi, is working.

How i can make the 2sxc api call without antiforgery token

Please help


Solution

  • That's simple - just make sure you have [AllowAnonymous] on your class.

    You can find working examples in the Mobius Forms app.

    See also: https://docs.2sxc.org/web-api/specs/webapi-security.html and https://docs.2sxc.org/net-code/web-api/custom-web-api-security.html