Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jmurphy1267's avatar

API Authentication with Vue and standard Authentication

I am developing a website right now that uses Laravel web routes for the pages and then it will call an api to retrieve the data in a vue component. There could be up to 3 different api's that are all separate projects.

I am thinking about using JWT for the api but not sure how I would make it were the session and the JWT are in sync with expiration times. I don't want the user to have to login in and then relogin to renew a JWT before the session has expired.

Is it possible to do what I want to do keep the session and JWT expirations in sync or are there any better ways to implement a better solution?

0 likes
2 replies
ejdelmonico's avatar

If you use Passport and the provided middleware, everything will be done for you. As far as auth, I just create the views as Vue components and list the auth routes that I am using in api.php.

jmurphy1267's avatar

But each api will be its own separate project not included in the frontend project.

Please or to participate in this conversation.