#Not able to authenticate my users

13 messages · Page 1 of 1 (latest)

mortal fern
spark wave
#

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.

mortal fern
torpid bronze
#

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

mortal fern
#

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.

torpid bronze
#

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

weary roost
#

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.

spark wave
#

Along withSANCTUM_STATEFUL_DOMAINS iirc

weary roost
spark wave
#

Still might be worth to check