archtechx / tenancy

Automatic multi-tenancy for Laravel. No code changes needed.
https://tenancyforlaravel.com
MIT License
3.68k stars 434 forks source link

CSRF token mismatch when InitializeTenancyByRequestData middleware is used #1244

Closed jialeee17 closed 3 months ago

jialeee17 commented 3 months ago

Bug description

I'm building the APIs for my SPA using the SPA Authentication. I realized that when I apply any of the tenancy initialization middlewares such as InitializeTenancyByRequestData, I got the "CSRF token mismatch." issue. Is anyone facing the same issue?

Steps to reproduce

  1. Make a request to get CSRF token
  2. Make a POST request

Expected behavior

Receive 419 "CSRF token mismatch" error response

Laravel version

11.18.1

stancl/tenancy version

3.8

stancl commented 3 months ago

Please use the right channels for support questions.