Skip to content
Advertisement

How to integrate React App With Laravel Sanctum on Apache2


I use React App on localhost:3000
For Laravel API I use apache2 from Laradock and site is: site.localhost
To authorize users I use Sanctum
Problem is I can not get cookies from sanctum/csrf-cookie (i got them in response header but they are not appear in cookies) and then got 419 code when i try to login via API My .env
JavaScript

And this is how i get XSRF token

JavaScript

Is this Sanctum configuration is ok ?

Advertisement

Answer

This is now solved.

  1. Add the following to /etc/hosts:

    JavaScript
  2. Then configure apache for these domains.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement