79695718

Date: 2025-07-09 13:38:26
Score: 0.5
Natty:
Report link

I experienced something like this in Laravel 12.
My issue was solved by where i placed the middleware.
This did not work with CSFR issued tokens, but it worked with normal api tokens issued by sanctum.


Route::middleware(['auth:sanctum'])->group(function () {
    //Routes
});

I moved the middleware definition and that fixed the problem.

Route::group(function () {
    //Routes
})->middleware(['auth:sanctum']);
Reasons:
  • Blacklisted phrase (1): did not work
  • Whitelisted phrase (-1): it worked
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Jakob Espersen