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

BrahimBJZ's avatar

Disable session cookies in Laravel

I am using Laravel API Tokens for authentication from my frontend, and what I do to get the api_token is make a POST request to LoginController@login, the problem here is that it creates a session cookie for me and in the next requests to /login it simply returns me the user without even reviewing the information (among other problems I have).

Basically I would like session cookies not to be generated, or, if that is not possible, not do the verification. Sorry for my bad english.

Also mention that I have tried this answer but I get this error when remove StartSession middleware: "message": "Session store not set on request.","exception": "RuntimeException",

0 likes
1 reply

Please or to participate in this conversation.