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

RobTheDev's avatar

Sanctum Cookie for SPA in NuxtJS - sanctum forces cookies to refresh on each request... but why?

Hey, Good People of Laracast!

I do have a question or few about Sanctum and cookies. I've noticed that sanctum sends me XSRF cookie regardless of me hitting the cookie endpoint. It was not happing before, then it was, then it wasn't and now it is happening again! Don't know what I did there!

Furthermore with each request to the backend API cookies are refreshed, XSRF one and session one. I completely do not understand why. (Does it mean that session gets a new TTL?)

Apart from that, I see I am logged in but I do not understand the implications of this mysterious behavior. I've elaborated on that problem greatly in my SO post. Could someone explain that to me or let me know what to read to learn what is happening and if it is a problem or not?

https://stackoverflow.com/questions/72954961/laravel-api-sanctum-nuxt-auth-weird-cookies-behaviour-i-dont-get-it

0 likes
8 replies
RobTheDev's avatar

Hi @sos99

Thanks for the reply. I know about breeze and I have my own everything pretty much set up. I am interested more in understanding this particular problem which I mentioned in the SO post.

Unfortunately, these links do not answer any of my questions. But I appreciate it either way!

sos99's avatar

@RobTheDev OK, maybe you should give us more information about your configurations?

RobTheDev's avatar

@Fomaxwebcreator I have no option to check it now but I will try to check it soon, during the weekend and I will let you know. That project has been kinda left behind.

1 like

Please or to participate in this conversation.