Reputation: 321
Sanctum Version: 2.11.2
Laravel Version: 8.55.0
PHP Version: 7.4.20
Laravel is running on: http://127.0.0.1:8000
front end (vue) is running on: http://localhost:3000
I put all following in my .env file
COOKIE_SAME_SITE_POLICY=strict
SESSION_SECURE_COOKIE=false
SESSION_DOMAIN='.127.0.0.1'
SANCTUM_STATEFUL_DOMAINS='.localhost,.localhost:3000,127.0.0.1,127.0.0.1:8000,::1'
When I'm trying to authenticate from a different domain it gives 419 error CSRF token mismatch, the first request "http://127.0.0.1:8000/sanctum/csrf-cookie" which must set the cookies does not set anything however if I try the same request inside laravel instance it sets the cookies and works as expected
how every the same request sets the cookies successfully in postman
Steps To Reproduce:
'supports_credentials' => false,
to 'supports_credentials' => true,
from /config/cors.phpUpvotes: 0
Views: 838
Reputation:
You cannot set a cookie for a different domain for security reasons
Upvotes: 1