Show your code please.
Unable to retrieve XSRF-TOKEN cookie from Laravel Sanctum API using Chrome extension
Hi,
I'm trying to retrieve the XSRF-TOKEN cookie from my Laravel Project which is using Laravel Fortify with Laravel Sanctum API using a fetch call from a Chrome extension, but I'm unable to do so. I've followed the instructions in the Laravel Sanctum documentation and have set the SANCTUM_STATEFUL_DOMAINS variable in my .env file correctly, but I'm still encountering issues.
I've verified that my server is properly configured to allow cross-origin requests by checking the response headers of my API requests in my browser's developer tools. The Access-Control-Allow-Origin header is set to the origin of my Chrome extension.
However, it seems that my server's CORS settings may not be allowing the X-XSRF-TOKEN header to be sent in requests. I've tried adding the X-XSRF-TOKEN header to my server's CORS configuration using the Access-Control-Allow-Headers header, but this hasn't resolved the issue.
You can check the screenshot of the network tab request "api/sanctum/csrf-cookie" xcsrf-token is in the response header but there is also a warning icon. it's first day of my account so i can not provide direct link of screenshot but i'm add link in parts jsut remove space and "+" sign pasteboard + .co + FYA4JL5MB7Mr + .png
It might be, SESSION_DOMAIN issue. since it's a Chrome extension it doesn't have any domain.
Any assistance in resolving this issue would be greatly appreciated.
Steps to reproduce Make a fetch call to the sanctum/csrf-cookie endpoint with the credentials option set to 'include' from Chrome extension,
Additional information Laravel version: 8.60.0 PHP version: 8.0.7 Operating system: Windows 10
Please or to participate in this conversation.