Level 63
Just solved ... I forgot the port APP_URL=http://localhost:8000.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello,
Hmmm ... not the first time I do that ... but first time with Laravel 12.
I get a 419 error when log in with Fortify and Sanctum.
UPDATED I have removed the SESSION_DOMAIN value and now I get a 401 error.
Here is my code and configuration.
SESSION_DRIVER=cookie
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=localhost:8000 => SESSION_DOMAIN=
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) {
$middleware->statefulApi();
})
->withExceptions(function (Exceptions $exceptions) {
//
})->create();
async login(user) {
await axios
.get('/sanctum/csrf-cookie')
.then(response => {
axios.post('/login', {
email: user.email,
password: user.password
}).then(response => {
axios
.get('/api/user')
.then(response => {
console.log(response.data);
}).catch(error => {
console.log('problem while retrieving user');
});
}).catch(error => {
console.log(error);
});
});
},
Just trying with this code, I get a 419 error.
What am I doing wrong ?
What am I forgetting ?
Can you help me please ?
Thanks ;).
V
Just solved ... I forgot the port APP_URL=http://localhost:8000.
Please or to participate in this conversation.