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

BernardoBF4's avatar

Cms and Api Authentication

Hello, fellow web artisans.

I am working on an application that has a Cms and also will have a ticket vending site. The Cms has an authentication and so does the site. The Cms will have a session authentication, because it does not need to be done using Apis, but the site will be using Apis.

Once I have made a question here on this forum asking how to separate the user table for those two auths. The answer was that I could just keep one table for both users and use that table for authenticating the users. For the data the site users wil have associated with their account, I would just store in a separate table and reference it. Now problem is: I need to make both the auths systems but I don't know how. DOes anyone has a source for me o visit and get a way to do this?

0 likes
7 replies
jlrdw's avatar

Is the CMS and the tickets separate back ends.

BernardoBF4's avatar

@jlrdw Exactly what I want is to use one table for authentication (User table/model) and make it possible to have both the Cms users login using session and site users, using Api (which requires a token for the other calls)

jlrdw's avatar

@BernardoBF4 Yes normal login for web based, and api would be token based. This is done all the time where part of an app is used for an api and other parts has web based login.

Figure out if you want to use passport or sanctum.

1 like
jlrdw's avatar

@BernardoBF4 if a SPA you could consider Sanctum. Otherwise carefully read over both documentations, and decide which as either will work for an API.

In my opinion only I would use Passport. But many here might say Sanctum.

1 like

Please or to participate in this conversation.