smartins/passport-multiauth
Extends Laravel Passport to support multiple authenticatable models and guards, such as users and admins, in one app. Map OAuth clients to guards, issue and validate tokens per provider, and keep authentication flows isolated without separate Passport installations.
User model. This package makes the OAuth guard/provider pair the unit of identity, so an app can issue and validate tokens for admins, customers, drivers, or partners independently. That unlocks a product decision most SaaS roadmaps eventually hit: do we model these as roles on one user table, or as genuinely separate identity domains?TokenRepository, ClientRepository, and personal-access-token factory for guard-aware versions — subtle, security-adjacent work with a long tail of edge cases (token refresh, revocation, scope leakage across guards). At 283 stars and MIT licensing, this is a cheap way to defer that spend and validate demand before committing.Consider it when:
Look elsewhere when:
users table with roles/permissions (Spatie, Bouncer, or Gates) actually models your domain. Multi-guard auth is a heavier hammer than most RBAC problems need, and it complicates joins and admin tooling permanently.For executives — one paragraph: We need to serve a second class of user (partners / sellers / field staff) with their own login and their own tokens. Today our auth stack assumes one kind of user, and retrofitting it properly is several weeks of security-sensitive engineering. An open-source MIT-licensed package exists that closes most of that gap for roughly a day or two of integration. I recommend we use it as a bridge to validate demand this quarter, with an explicit ticket to replace or formally adopt it — not as a permanent foundation. The risk is not cost, it's staleness: the package hasn't been updated since 2020, so we should plan to own it.
For engineering — the ask: Spike it for two days against our current Passport version. If it installs cleanly and the guard-aware token flow passes our existing auth test suite plus three new cases (cross-guard token rejection, refresh under a non-default guard, revocation isolation), vendor it into the repo and treat it as our code. If the Passport version mismatch requires patching internals ourselves, we stop and re-scope — the build estimate stands at 3–6 weeks and we'd rather spend that deliberately than by accident.
The honest framing: This is a good decision for deferring cost and a bad decision for avoiding it. It buys us a quarter of validated learning on a new user segment at roughly 5% of the build cost — provided we accept that the dependency is frozen in time and budget the ownership accordingly. The signal to watch is simple: if the spike requires us to modify Passport internals ourselves, the package has already stopped paying for itself.
How can I help you explore Laravel packages today?