I'm starting to make an application for myself - on the frontend in React, and the backend in Laravel. I am completely inexperienced in React and am trying to do authentication at this point.
On the backend I am using Laravel Sanctum and Fortify, and on the frontend I tried koole/react-sanctum. And when sending a request I got that
Access to XMLHttpRequest at 'http://localhost:8080/sanctum/csrf-cookie' from origin 'http://localhost:3000/' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.*.
I'm not sure if I need to allow CORS on the backend or frontend side. Maybe anyone have any idea how to solve that or know on which side the problem is.
I used create react app and set in package.json something like this:
"proxy": "http://localhost:8080/"
but unfortunately nothing helped.
Via Active questions tagged javascript - Stack Overflow https://ift.tt/9OibGms
Comments
Post a Comment