Here is a good larabit by Andrew which has answers to your questions: https://laracasts.com/series/andrews-larabits/episodes/4
Need help with understanding Authentication with Sanctum and SPA
Hello,
If i am using 2 separate repos for frontend (Vue for example) and the backend is Laravel. What exactly happens? Let's say I setup everything correctly (Perhaps using Fortify), and I send request to /login - if authentication is successful - what happens? Will a cookie be set in the browser with the special authentication token and then I will need to check if that cookie exists for every page on my SPA that requires authentication?
Also, if I'm already logged in on my SPA, and I want to perform an action that requires authentication (Not just viewing a page), how will Laravel know that the user is logged in? Will I need to send this authentication cookie somehow on every request? (Not talking about the CSRF protection)
*I probably asked some questions that look trivial to you so the answer could be simple (I just got confused regarding the difference between using Laravel authentication when it's not separated project vs using it on a separated SPA - i.e. stateless vs stateful authentication)
Thanks!
Please or to participate in this conversation.