#Not able to authenticate my users
13 messages · Page 1 of 1 (latest)
There's a whole lot of unknowns here. But seeing as there's an OPTIONS request, it looks like you're making a cross-origin request. Session authentication (Sanctum) would only work on the same top level domain, not on different domains.
Hmm, well the domains are set up as following:
admin.domain.com
api.domain.com
Should be good no? Got the CORS issue fixed.
I used that module long ago, it is quite good but took me a lot of time to figure it out. Your env file needs to have the sanctum domain(forgot the var name) set as .domain.com
Been there. But overall pretty nice. I'm just new to all this so even more stuff for me to figure out. Laravel community has been amazing though!
But the domains has been set correctly as the frontend does communicate with the backend. If I write a wrong login, then it tells me a user doesnt exist. If I write the correct login, it fails.
Oh yea its called SESSION_DOMAIN
I remember I had to set it to .domain.com or just domain.com
Yea, the communication works but your session isnt working properly
Yeah the session domain is the most likely cause. You can verify it by checking if the browser includes the correct session cookie in requests after login. The correct session cookie is the one you can see in the login POST response.
Along withSANCTUM_STATEFUL_DOMAINS iirc
I think that's handled more or less automatically now?
As long as the APP_URL is set properly I think
Still might be worth to check