Pochwar / laravel-vue-spa

82 stars 31 forks source link

Cors policy #25

Open tambach opened 4 years ago

tambach commented 4 years ago

After clone the project try to login or register but every time have this type of issue : Access to XMLHttpRequest at 'http://127.0.0.1:8000/api/auth/login?email=admin@test.com&password=admin' from origin 'http://localhost:8000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Can you help me?

Pochwar commented 4 years ago

Hi,

The issue is because you try to access the API on domain 127.0.0.1 from your front on domain localhost and the CORS policy is to prevent access the API from another domain.

So just try to access to your front from http://127.0.0.1 or to change the variable in the .env file to localhost.

tambach commented 4 years ago

Thank you very much