Im using Laravel 11 with Postman to test my API. im planning to use VueJS later.
I created a Authentication Controller, and im using MySQL database, I also migrated everything (Laravel 11 migrations)
Now when I send a request to my route which is /register
from postman I get 419 page expired
.
use IlluminateFoundationApplication;
use IlluminateFoundationConfigurationExceptions;
use IlluminateFoundationConfigurationMiddleware;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__ . '/../routes/web.php',
api: __DIR__ . '/../routes/api.php',
commands: __DIR__ . '/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware) {
})
->withExceptions(function (Exceptions $exceptions) {
})->create();
web.php
Route::post('/register', [AppHttpControllersTestController::class, 'register']);
Route::post('/login', [AppHttpControllersTestController::class, 'login']);
also I would like to mention that i send a pre-request to /sanctum/csrf-cookie
first.
pm.sendRequest({
url: "http://localhost:9000/sanctum/csrf-cookie",
method: "GET"
}, function(error, response) {
if (!error) {
const xsrfToken = pm.cookies.get("XSRF-TOKEN");
pm.collectionVariables.set("xsrf-cookie", xsrfToken);
}
});
2