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

Digitalam's avatar

Which System to Authenticate Multiple APIs?

Hi! I'm building a site with Laravel as the main site. I have Flarum (SPA forum) and GetCandy(SPA)/Aimeos e-commerce API on my subdomains. I want to authenticate all my APIs using a centralized user base on my main site.

Should I use Passport or Sanctum to achieve this? Have anyone did it before?

0 likes
4 replies
martinbean's avatar

@digitalam Passport or Sanctum will be the authentication mechanism, but you’re going to also need to look into SSO (single sign-on) if you want to have multiple clients to authenticate against a single authorisation server.

Digitalam's avatar

By SSO, you mean every app sharing the same session for authentication? Because I'm looking for a way where users don't have to log in again to my first party APIs

martinbean's avatar

@digitalam Multiple apps can’t be magically logged in. Each apps needs to check somewhere whether the user trying to access is authenticated or not. You can’t log in to App A and magically be logged in to App B and App C.

1 like

Please or to participate in this conversation.