Cookie not being set on Angular SPA
Hello guys,
I am building a CMS which will have admin panel built usng Angular as an SPA and front will be built using Laravel Blade. I've decided to go with Sanctum + Fortify to authenticate both SPA and normal application so I have minimal duplication(would you consider this good practice to go with, considering I will have 2 login one for SPA and one for normal app?).
Backend app is hosted(lets say cms.test.com), I am building Angular locally once I try to get CSRF token from /sanctum/csrf-cookie route, I get set-cookie header from response but cookie is not being set on my local browser. This is cause of domain mismatch, because I'm pinging Laravel app which is on cms.test.com domain but I'm on localhost:4200.
How can I overcome this issue without needing to install Laravel locally and test it from there? Since it is not setting CSRF cookie I am guessing authentication cookie from sanctum will also not be set. Is there a way to work with hosted app on a domain (laravel app) with locally installed angular SPA?
Regards
Please or to participate in this conversation.