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

Token Authenticator Laravel Package

youshido/token-authenticator

youshido/token-authenticator adds token-based authentication to Laravel apps, letting you issue, validate, and revoke API tokens through a dedicated guard and middleware that plug into your existing user model and routes.

View on GitHub
Deep Wiki
Context7

Getting Started

First, the framework reality check. Despite the assessment framing, youshido/token-authenticator (published as TokenAuthenticatorBundle) is a Symfony bundle, not a Laravel package. It will not install or boot inside a Laravel app. If your stack is Laravel, this package is a non-starter — you'd be reimplementing its ideas with Sanctum/Passport instead (see Gotchas). The guidance below assumes you're evaluating it for a Symfony codebase you maintain.

Minimal setup in a Symfony app:

  1. composer require youshido/token-authenticator
  2. Register the bundle in config/bundles.php (Symfony 4+ flex style) or AppKernel.php (Symfony 3.x style).
  3. Configure your firewall in config/packages/security.yaml to use the bundle's token authenticator/guard for a stateless firewall, e.g. a dedicated api firewall with stateless: true and the bundle's authenticator listed under guard.authenticators (older Symfony) or custom_authenticators (newer).
  4. Point the authenticator at your user provider and token storage (entity/repository or the bundle's configured service).

Where to look first: the bundle's DependencyInjection/Configuration.php and its README — this is a 2019-era, zero-star package with no dependents, so the README and the config tree are your only real documentation. Read the config tree before trusting the README; they drift in small packages.

First use case: protect a single JSON API endpoint. Issue a token at login, store it, then require Authorization: Bearer <token> (or whatever header/param the bundle expects — confirm in its config) on subsequent requests and let the guard resolve the user. Get one happy-path request working end-to-end before wiring anything else.

Implementation Patterns

Stateless API firewall. The intended shape is a separate api firewall with stateless: true, no session, no form login, and the token authenticator as the only entry. Keep it isolated from your main firewall so web sessions and API tokens don't bleed into each other.

Token issuance flow. Typically: a login/credentials controller validates username+password, generates a token (random bytes, hashed before persistence), persists it against the user with an expiry, and returns the raw token once. Never store the raw token — store a hash and compare on lookup.

Token lookup + user resolution. The authenticator takes the incoming token, looks it up (by hash), checks expiry/revocation, and returns the associated user. Wire your user provider so the guard receives a proper UserInterface. If the bundle expects a specific token entity contract, implement it rather than fighting the guard.

Header vs. query param. Configure one canonical transport (header preferred) and reject the other to avoid tokens leaking into logs, referrers, and browser history.

Lifecycle hooks. Put expiry checks, revocation, "last used" timestamps, and rotation in the token repository/service layer, not scattered in controllers. A small TokenManager service wrapping create/validate/revoke keeps the guard thin and testable.

Testing. Unit-test the token manager (expiry, revocation, hashing) directly; use Symfony's KernelBrowser/functional tests for the firewall path. Because the package is unmaintained, your test suite is the only regression net you'll have.

Gotchas and Tips

  • It's Symfony, not Laravel. Confirm this before investing time. For a Laravel equivalent, use Laravel Sanctum (SPA + simple API tokens) or Passport (full OAuth2). Don't try to port this bundle.
  • Abandoned since April 2019. No releases in years, zero stars, zero dependents. Expect no security patches. Do not adopt it for new projects; treat it as legacy you're either replacing or wrapping.
  • Guard system is dead. If the bundle relies on Symfony's Guard component (likely for its era), Guard was deprecated in Symfony 5.3 and removed in 6.0. On modern Symfony you'll need to rewrite the authenticator as a AbstractAuthenticator/AuthenticatorInterface, or you're pinned to an old Symfony. This is the biggest practical blocker.
  • Zero dependents = zero field reports. No Stack Overflow answers, no blog posts, no known-issue list. Budget extra time for reading source, and pin the exact version in composer.json.
  • Security defaults you must verify yourself: constant-time comparison (hash_equals) for tokens, hashed-at-rest storage, enforced expiry, revocation on password change, and rate limiting on the token endpoint. Small packages frequently omit some of these.
  • Debugging: use bin/console debug:config <bundle_alias> and debug:container to confirm services and config actually loaded — misregistration is the most common silent failure. Enable the profiler's security panel to see which authenticator ran and why a request was rejected.
  • Extension points: customize via the bundle's config tree first, then by overriding the token repository/service in your app's service config. If you must subclass core classes, keep those overrides in one place — they're your upgrade/migration surface when you eventually replace the bundle.
  • Migration tip: because the bundle is thin, replacing it with a hand-rolled AbstractAuthenticator (Symfony 6+) or switching to a maintained token package is usually a day or two of work. Factor that into any "should we keep this?" decision.
  • License is MIT, so forking and maintaining internally is legally clean — a reasonable path given the abandonment.
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.
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log