srenert
2 months ago
471
2
Laravel

POST request in postman - 419 expired

Posted 2 months ago by srenert

I'm on Laravel 7.x version and I am having an issue with csrf cookie.

My application works fine, but in Postman I am getting a 419 | expired error while making POST requests. GET requests work great after authentication.

I'm making the following requests (in sequence):

/sanctum/csrf-cookie /login /user

Then following that, all GET requests work great. However, every POST request fails with a 419 error.

During /sanctum/csrf-cookie request, I'm setting the following in postman

pm.environment.set("xsrf-cookie", pm.cookies.get("XSRF-TOKEN"))

and then using that {{xsrf-cookie}} value with a X-XSRF-TOKEN authorization header.

I've googled everything I can think of, but can't get past this problem (in postman only).

Please sign in or create an account to participate in this conversation.