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

asdasdsa's avatar

Is API endpoints what I need?

Hi

Im developing a rather simple quiz application at the moment. I have a user front end were they participate in the quiz. I also have a admin front end were I manage questions for the quiz. Both are made with VueJS. And it seems that I have things up and running and now I want to actually make the end points only for registered users.

All end points are in the api.web routes file, because I thought that is was the way to go - im not sure about that... The Laravel Passport docs talk about issuing tokens for clients etc etc. That doesn't seem to be what I want. Ofc I my site attracts some traffic, I might try to make an IOS app - do I need the API then?

What am I doing here?

0 likes
3 replies
drewdan's avatar

How do you plan to authenticate the user sessions?

jlrdw's avatar

Maybe a regular web app would be better for a quiz.

1 like
aschmelyun's avatar

@asdasdsa It sounds like what you want to use is Laravel Sanctum. You can use either the SPA authentication method (which seems like it would be applicable with both your VueJS applications), or you can issue individual tokens after a user signs in and run the API calls with Authentication: Bearer {token} headers.

If you want to learn more, there's this tutorial which goes in deep with authenticating a single-page JS app with Sanctum.

1 like

Please or to participate in this conversation.