shaneomac wrote a reply+100 XP
5mos ago
You should not need this " axiosClient.get('/sanctum/csrf-cookie').then(response => { " What does your app.blade.php look like?
You don't have the CSRF loaded in the head do you?
shaneomac wrote a reply+100 XP
5mos ago
shaneomac wrote a reply+100 XP
6mos ago
@janum Thanks for all that insight!
@jussimannisto It is all become super clear the last few days for me where I have gone wrong. I just wish I knew all this info months ago but never again will I struggle.
Appreciate your responses!
shaneomac liked a comment+100 XP
6mos ago
Speaking of LLMs being wrong:
- For Inertia, always make the first request visit /sanctum/csrf-cookie A lot of devs forget this step. Once the cookie is set, the CSRF header is handled automatically. No need to manually fetch the token at all.
This is pointless with Inertia. The initial Inertia page response already includes the cookie. You'd only need this step if you had a pure SPA with Laravel as a backend API.