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

Laravel Passport Claims Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

  • Architecture fit: Strong fit only if the platform already uses Laravel Passport as its OAuth2/JWT issuer and downstream services need embedded authorization context such as tenant, role, user attributes, or custom scopes. The package is a thin extension to Passport, not an identity provider, gateway, or policy engine. It is a poor fit for non-Laravel stacks, non-Passport token issuers, or teams expecting vendor-supported auth infrastructure.
  • Integration feasibility: Low implementation effort for a Laravel team already on Passport: Composer install, service provider registration, configuration, and claim resolver callbacks. Feasibility depends on access to Passport’s extension points in the target version. A TPM should fund a short compatibility spike and a token-contract test before committing.
  • Technical risk: Medium. The package is niche (87 stars), likely single-maintainer, and depends on Laravel Passport internals that can change across major versions. Main risks are version incompatibility, claim collisions with standard JWT claims, token bloat, latency from claim resolution, and security review gaps. Claims become part of the auth contract, so schema ownership must be explicit.
  • Key questions: Which claims are required, and who owns their schema? Are claims resolved per user, per client, per tenant, or statically? What Laravel/Passport/PHP versions must be supported? Do claims apply to access tokens, refresh tokens, personal access tokens, and client credentials? How are claim names namespaced to avoid collisions? What is the acceptable token size and gateway header limit? What happens when a claim resolver fails or returns stale data? Is there an internal fork/vendor plan if upstream stalls?

Integration Approach

  • Stack fit: Best for Laravel applications using Passport as the token issuer, with Laravel APIs, API gateways, or JWT-verifying services as consumers. Use namespaced custom claims and avoid redefining registered JWT claims. Confirm behavior with guards, scopes, personal access tokens, and client credentials.
  • Migration path: Introduce claims additively so existing tokens remain valid. Deploy the issuer with claims enabled behind a feature flag, update consumers to tolerate missing claims, then enforce claim-based authorization. Avoid changing token shape and semantics in one release.
  • Compatibility: Pin the package version and run contract tests against the exact Laravel, Passport, PHP, and JWT library versions in production. Verify refresh-token behavior, token revocation, key rotation, and multiple auth guards. Maintain a small internal test harness that asserts issued JWT JSON contains expected claims.
  • Sequencing: 1) Inventory downstream token consumers and required claims. 2) Run security and compatibility spike. 3) Add package in staging with test claims. 4) Update one consumer to read a claim. 5) Canary by client or environment. 6) Roll out broadly with monitoring. 7) Document claim schema, ownership, and rollback.

Operational Impact

  • Maintenance: Low code footprint but meaningful dependency trust. Pin versions, monitor upstream activity, and keep a vendor/fork contingency. Assign internal ownership for claim schema and package upgrades.
  • Support: Community-only support with no SLA. Escalation must be internal. Document fallback behavior if the package is abandoned or incompatible with a future Passport release.
  • Scaling: Claim resolution overhead is usually small but can add latency if resolvers hit databases or remote services during token issuance. Cache resolver data and keep claims compact. Watch JWT size against gateway and header limits.
  • Failure modes: A claim resolver exception can block token issuance. Missing or stale claims can cause downstream authorization failures. Claim collisions, oversized tokens, key rotation issues, and consumer cache staleness are also risks. Mitigate with timeouts, safe fallbacks, claim validation, and issuance monitoring.
  • Ramp-up: Laravel developers can integrate quickly; consumers need OAuth2/JWT literacy to validate and handle claims safely. Budget a short spike, a test harness, and claim-schema documentation. Treat this as a tactical enabler, not strategic auth infrastructure.
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.
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings