Skip to content

fix: enable Jetstream API feature so users can issue API tokens - #218

Merged
morcen merged 1 commit into
mainfrom
fix/issue-93-enable-api-tokens
Sep 8, 2026
Merged

fix: enable Jetstream API feature so users can issue API tokens#218
morcen merged 1 commit into
mainfrom
fix/issue-93-enable-api-tokens

Conversation

@morcen

@morcen morcen commented Sep 7, 2026

Copy link
Copy Markdown
Owner

What was broken

Jetstream's Features::api() was commented out in config/jetstream.php, so Jetstream never registered its /user/api-tokens routes/controller. That meant a new user had no way to create, list, or delete a Sanctum personal access token through the UI or any endpoint.

This is a serious functional gap because, per CLAUDE.md, the REST API under /api/v1/* (endpoints, events, deliveries, webhooks/trigger/{eventName}) requires auth:sanctum on every route — i.e. a bearer token is the only way to call it. With token issuance disabled, the platform's core "trigger webhook via API" integration surface was completely inert for real users without direct database/tinker access.

The gap was masked in CI: tests/Feature/CreateApiTokenTest.php, DeleteApiTokenTest.php, and ApiTokenPermissionsTest.php each call markTestSkipped(...) when Features::hasApiFeatures() is false, so the suite reported green while the token-issuance code path was never exercised. The frontend (resources/js/Pages/API/Index.vue, Partials/ApiTokenManager.vue, and the "API Tokens" nav item) already anticipated the feature being enabled but was unreachable.

What changed

  • Uncommented Features::api() in config/jetstream.php, which registers Jetstream's built-in /user/api-tokens routes (HasApiTokens was already present on App\Models\User, so no model changes were needed).
  • Added tests/Feature/ApiTokenFeatureEnabledTest.php, a regression test asserting Features::hasApiFeatures() stays true and that an authenticated user can reach /user/api-tokens, so this can't silently regress again.
  • The three previously-skipped tests (CreateApiTokenTest, DeleteApiTokenTest, ApiTokenPermissionsTest) now run for real and pass.

Testing

  • vendor/bin/pint --dirty — pass
  • php artisan test — full suite passes (224 passed, 4 pre-existing/unrelated skips, 0 failed)

Note

Issue #93's own analysis flags that once tokens can be issued, the ability checkboxes shown in the token-creation UI aren't currently enforced by the API controllers (tokenCan()/ability: middleware) — that gap is already tracked separately in #53 and is out of scope for this fix, which is just about restoring token issuance itself.

Fixes #93

Jetstream's Features::api() was commented out in config/jetstream.php,
so the /user/api-tokens routes were never registered. New users had no
way to create, list, or delete a Sanctum personal access token through
the UI or any endpoint, even though the documented REST API under
/api/v1/* requires a bearer token via auth:sanctum on every route. The
"API Tokens" nav item and its Vue pages already existed but were
unreachable, and CreateApiTokenTest, DeleteApiTokenTest, and
ApiTokenPermissionsTest were permanently skipped via
Features::hasApiFeatures() checks, masking the gap in CI.

Uncomment Features::api() to register the token-management routes and
un-skip the existing coverage, and add a regression test asserting the
feature stays enabled and that the API tokens page is reachable.

Fixes #93

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JcTTctpWp8wW5bErM58EqX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Jetstream's Features::api() is disabled, so the documented REST API has no way to issue tokens

1 participant