Authentication Issue with Sanctum
Hello everyone,
I am currently facing an issue with the authentication process in my project when using Sanctum. I have successfully implemented Sanctum to authenticate users using session-based cookies. In Postman, I have set up a pre-request script to obtain the X-XSRF token, and everything seems to be working fine as I receive the cookie and set it in the header. Additionally, I have set the 'Accept' header to 'application/json' and can successfully log in.
However, the problem arises when I attempt to make a request to my API endpoint. Instead of getting the desired response, I am redirected back to the login route. I'm puzzled as to why this is happening, and I'm hoping someone can shed some light on the issue.
Furthermore, I've noticed a peculiar behavior when making a request to the "/sanctum/csrf-cookie" route. Upon making this request, I receive both the X-XSRF cookie and the API session cookie, even without being logged in. Is this behavior normal? I find it quite unusual and would appreciate any insights on this matter.
If anyone has encountered a similar issue or has any suggestions on how to resolve it, your assistance would be greatly appreciated.
Thank you in advance for your help.
Please or to participate in this conversation.