Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

JandersonBrito's avatar

API for Games

Hi, I am creating an API that will send data to my Unity 3D game, but when I am posting my API in C # I can't send the csrf_token () field, which gives me the 419 response error, I put the route in question except in the VerifyCsrfToken middleware, then returns me error 500. what would be a solution to submit my request?

0 likes
13 replies
ftiersch's avatar

Can you show your middleware?

Also: Does it work if you comment out the VerifyCsrfToken Middleware in the Kernel.php file?

JandersonBrito's avatar

i just put this except.

protected $except = [
   'http://127.0.0.1:8000/test'
];
JandersonBrito's avatar

I commented the VerifyCsrfToken class in the kernel.php and get the same result.

ftiersch's avatar

I don't think you have to put the whole URL in there. Just put 'test' in the array.

mikenewbuild's avatar
Level 22

Are you using the web routes? Sounds like you may be better using api routes if I have understood what you're trying to achieve correctly.

3 likes
JandersonBrito's avatar

indeed i'm using the web routes, gonna switch for api routes and observe the results.

Please or to participate in this conversation.