Auth in browser / Vue app

Posted 7 months ago by smadeira

I have a browser-based app with full login/authentication abilities and that is all working fine. It uses that Laravel Auth functions.

Performance in some areas was slow with all the page refreshes so I decided to speed it up a bit. Now, I go to the site and login as before. Then I load a page via a web route called People which access to is controlled by Auth. So far so good.

To speed things up, I decided to make all the functionality on the page a Vue app. I'm running into an authentication problem. How do I make the connection between an api route (/api/people/3/update, for example) and the Auth that was used to load the page initially? Prior to loading the page, I store a number of configuration parameters in the session (connection strings to 3rd party systems that are specific to that user, for example.)

I think what I am asking is how do I link the web authentication (Auth::user(), Auth::guest() stuff and associated session data) with requests coming in from api calls from my Vue app?

Please sign in or create an account to participate in this conversation.