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

mrlanphear's avatar

Sanctum: log in on either site?

I've got a Laravel backend app on my.domain.com and a Nuxt frontend with nuxt-auth on www.domain.com. The Sanctum auth works great when logging in via www. My question is if someone logs in via the my.domain site, how can that cascade so that they are also logged in on www.domain? I assume there is some sort of check that I'll have to make on my Nuxt app but am unsure of the next step. Any assistance would be very helpful. Thanks!

0 likes
3 replies
rodrigo.pedra's avatar

I am not sure from memory, but I think if you set this variable on your .env:

SESSION_DOMAIN=.domain.com

The session cookie will be shared amongst subdomains.

Note the leading dot (.) before the domain name.

henryavila's avatar

Hi, did you found the solution for this? I'm trying to make the same thing. MAke sanctum recgnize the use already authenticated on Laravel app without making him login manually.

Please or to participate in this conversation.