Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Passport Multiauth Laravel Package

hamedov/passport-multiauth

Adds multi-guard authentication to Laravel Passport, letting separate user models and providers (admins, customers, etc.) each issue and validate their own OAuth2 tokens through distinct guards. Simplifies per-guard client credentials, token parsing, and route protection in Laravel APIs.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. The package addresses a real gap in Laravel Passport: Passport's password grant resolves a single user provider, so applications with genuinely separate identity tables (e.g. users, admins, merchants) cannot issue OAuth2 tokens per identity type without custom grant types. This package supplies those grants plus per-guard provider resolution. If our target architecture requires one OAuth2 token endpoint serving multiple distinct identity stores, it is directionally correct. If our need is merely role separation or first-party SPA/mobile auth, it is over-engineered — Passport token abilities/scopes on a single users table, or Sanctum, would cover it with first-party support.

Integration feasibility. Mechanically straightforward: Composer install, publish config, register custom grants in AuthServiceProvider::boot(), define guards/providers in config/auth.php, and optionally apply a trait to identity models. The work is not the wiring; it is validating that the grant correctly binds a request to the intended provider and client. That validation is entirely on us — there are no dependents, no integration examples in the wild, and 5 stars of social proof.

Technical risk — high. Three compounding factors:

  1. Abandonment risk. Zero dependents and negligible adoption mean no battle-testing and no upgrade pressure from anyone but us. Laravel and Passport majors will break this package before the maintainer notices.
  2. Private-API coupling. Custom grants subclass League\OAuth2\Server grant types and Passport bridge/bridge-scope internals, which are not covered by Laravel's BC promise. Passport 11/12 changed client model handling, route registration, and hashing behavior; expect breakage on each major.
  3. Security blast radius. This code sits directly on the credential-validation and token-issuance path. A provider-resolution bug is not a UI defect — it is cross-tenant token issuance or privilege escalation. Auth-critical code with a user base of ~zero has had no adversarial review.

Key questions.

  • Do we actually need multiple user providers, or one identity table with roles/abilities? (Most "multiauth" requests collapse to the latter.)
  • Do we need OAuth2 semantics at all — third-party clients, refresh tokens, scopes — or is this first-party auth where Sanctum is the correct, supported answer?
  • Who owns the security review of the grant logic, and can we fund it before any production traffic?
  • What is our Laravel/Passport upgrade cadence, and are we willing to fork and maintain this on each bump?
  • Is there an actively maintained alternative, or is in-house implementation (~100–200 lines for a provider-aware PasswordGrant subclass) cheaper than adoption?

My recommendation: do not adopt as a dependency; treat it as a reference implementation. The code volume is small enough that owning a vendored, tested fork — or writing the grant ourselves — is lower total risk than depending on an unmaintained package on the auth path.

Integration Approach

Stack fit. Compatible in principle with Laravel + Passport on a standard LEMP/queue stack; no infrastructure requirements, no external services. The constraint is version alignment: pin Laravel and Passport to the exact minor versions the package was written against, and treat any bump as a change requiring a regression pass over all grant flows. This is a coupling we accept only if the feature is genuinely required.

Migration path. Recommended sequence:

  1. Spike (1 sprint). Stand up a throwaway branch with two providers, issue and refresh tokens for each, and attempt deliberate cross-provider abuse (admin client requesting a merchant token, refresh-token provider drift, mismatched client/provider pairing). Output is a go/no-go plus a written threat model.
  2. Decide build vs. adopt. If the spike passes, fork to an internal namespace and cut the upstream dependency. Do not consume the package directly from Packagist.
  3. Harden. Add integration tests covering every grant × provider × client combination, plus negative cases. Wire static analysis and dependency scanning into CI for the fork.
  4. Roll out behind a flag to a single low-risk identity type first; expand only after clean telemetry.

If the spike fails or the feature is not mandatory, fall back to single-provider Passport with abilities/scopes, or Sanctum for first-party clients.

Compatibility. Assume breakage on Laravel/Passport majors and budget for it explicitly in the roadmap. Also verify PHP version support, whether the package's service provider uses deferred/auto-discovery registration correctly, and whether its config publishing collides with Passport's own published config. If the package is already stale relative to our target Laravel version, that settles the decision — fork or rewrite, do not adopt.

Sequencing. Auth changes block everything downstream and are the hardest thing to reverse after clients ship. Land the identity model decision (multi-table vs. roles) before any code. Then the grant implementation, then client apps. Do not let mobile/web teams build against a provisional auth contract.

Operational Impact

Maintenance. Effectively 100% ours. With zero dependents, we are the only party who will ever file or fix an issue. Plan for a named owner and a recurring quarterly review of the fork against Passport release notes. This is the single largest hidden cost and should be stated in the business case, not buried.

Support. No vendor, no SLA, no maintainer responsiveness assumption. Internal escalation only. On-call runbooks must cover "tokens issued to the wrong provider" as a first-class incident class with a defined containment procedure (revoke by client, force re-auth by provider).

Scaling. No throughput concern — the package adds a provider-resolution lookup per token request, not per API call. Token validation remains Passport's, so runtime cost is negligible relative to the auth endpoints themselves. Scaling risk is organizational (knowledge concentration in one engineer), not technical.

Failure modes.

  • Provider confusion: a grant resolves the wrong provider and issues a token for an unintended identity type — highest severity, requires both validation and monitoring.
  • Silent degradation on upgrade: a Passport minor changes an internal method signature; auth fails or, worse, falls through to a default provider. Fail-closed must be verified explicitly.
  • Refresh path drift: refresh grants may not re-validate provider binding, letting a token outlive a provider change.
  • Scope leakage: custom grants bypassing Passport's scope checks.
  • Config drift: guard/provider misconfiguration in a single environment producing inconsistent auth behavior.

Mitigations: assert provider identity into token claims at issuance and verify on validation; structured auth logs with provider + client + outcome; alerting on anomalous provider/client pairings; automated cross-provider negative tests in CI.

Ramp-up. Low code volume, high domain knowledge. Any engineer touching this needs working fluency in OAuth2 grant flows, Passport's internals, and our guard/provider topology. Budget for a written design doc and a second engineer cross-trained before production. Given a 5-star, 0-dependent dependency on the credential path, the honest framing to stakeholders is: we are not buying a library, we are buying a starting point and inheriting the security review.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource