corbosman/laravel-passport-claims
Add custom claims to Laravel Passport access tokens. Drop the provided trait onto your User model, define a getExtraClaims() method, and your extra data is embedded in the JWT for clients to read. Lightweight, no config required.
tenant_id or org_id claim is often the cheapest path to tenant-scoped APIs and service-to-service calls. This package makes it a config-level decision rather than a fork of Passport internals — a meaningful input to "single database vs. schema-per-tenant vs. database-per-tenant" discussions, because tenant context becomes available at the edge.email, name, roles) in the ID/access token. This package supports satisfying those integration checklists without an identity migration.Consider adoption when all of the following hold:
Look elsewhere when:
To executives: This is a small, free, MIT-licensed utility that lets our existing authentication system carry the context our applications need — which customer, which organization, which permissions — inside the login token itself. The business value is speed and cost avoidance: it unblocks multi-tenant scoping and service-to-service authorization without an identity-platform migration or a new vendor contract. The risk is deliberately contained — the package is narrow, the code is replaceable in-house in days, and the decision is fully reversible.
To engineering: It hooks into Passport's token issuance to add application claims to the JWT, so downstream services can authorize locally instead of calling back to the user store on every request. It is a thin layer over Passport, so the real design questions are ours, not the package's: which claims, how large the token gets, and how we handle staleness. Adopt with a pinned version and an owner; treat the maintainer as a single point of failure and keep a ~100-line in-house implementation as the documented fallback. Do not use it as a substitute for a real authorization service if we expect permissions to change within a token's lifetime.
How can I help you explore Laravel packages today?