1

I have two separate projects frontend nuxt and backend laravel. I used netlify to deploy frontend and Hostinger to deploy backend. I used Nuxt auth and laravel sanctum as authentication. Even if the application runs without any problem in the local environment, after deploying, it gets a 419 response with a CSRF token miss match error. My .env is as follows. Please provide me a solution.

SESSION_DOMAIN=.netlify.app
SANCTUM_STATEFUL_DOMAINS=appname.netlify.app
  • 1
    In order to use the CSRF token within your front-end, the top-level domain must be the same in the case of laravel sanctum. for e.g., your backend domain should be like api.domain.com and front-end domain should be like domain.com, you can use subdomain to host your laravel API. – DCodeMania Nov 21 '22 at 11:47
  • That may be the issue. I'm using 2 different domains for the API and the Frontend. Thank you. – Nisitha Sankalpana Nov 22 '22 at 07:31

0 Answers0