dystcz / nuxt-sanctum-auth

Nuxt 3 + laravel sanctum authentication
134 stars 25 forks source link

Blocked By Cors #24

Open bacink opened 1 year ago

bacink commented 1 year ago

hy, thank u for your great jobs, iam pretty sure folowing intruction in readme file, but iam getting blocked cors i try'd edit .env in laravel, like SANCTUM_STATEFUL_DOMAINS but it still won't work, i use laravel 9 and nuxtjs 3 cookies based authentication Screenshot from 2023-05-20 21-47-04

kreejzak commented 1 year ago

Hi @bacink, have you put your frontend and backend url into the SESSION_DOMAINS and SANCTUM_STATEFUL_DOMAINS in the laravel .env file?

it should look something like this:

SESSION_DOMAINS=localhost,localhost:8000,localhost:3000,127.0.0.1,127.0.0.1:8000,::1
SANCTUM_STATEFUL_DOMAINS=localhost,localhost:8000,localhost:3000,127.0.0.1,127.0.0.1:8000,::1

In your case just add api.layanan.test,client.layanan.test, before the ::1 and it should probably work.

Hope it helps!

bacink commented 1 year ago

thank a lot, its works