From 7a3cafb0e1494dca0e7fda1f41cfaf55e210215e Mon Sep 17 00:00:00 2001 From: Morris Jencen Chavez Date: Mon, 7 Sep 2026 19:23:26 +0000 Subject: [PATCH] fix: enable Jetstream API feature so users can issue API tokens 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 Claude-Session: https://claude.ai/code/session_01JcTTctpWp8wW5bErM58EqX --- config/jetstream.php | 2 +- tests/Feature/ApiTokenFeatureEnabledTest.php | 31 ++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 tests/Feature/ApiTokenFeatureEnabledTest.php diff --git a/config/jetstream.php b/config/jetstream.php index 08d5ce4..7f838d2 100644 --- a/config/jetstream.php +++ b/config/jetstream.php @@ -60,7 +60,7 @@ 'features' => [ // Features::termsAndPrivacyPolicy(), // Features::profilePhotos(), - // Features::api(), + Features::api(), Features::teams(['invitations' => true]), Features::accountDeletion(), ], diff --git a/tests/Feature/ApiTokenFeatureEnabledTest.php b/tests/Feature/ApiTokenFeatureEnabledTest.php new file mode 100644 index 0000000..5f227ab --- /dev/null +++ b/tests/Feature/ApiTokenFeatureEnabledTest.php @@ -0,0 +1,31 @@ +assertTrue( + Features::hasApiFeatures(), + 'Jetstream\'s Features::api() must stay enabled, otherwise the documented '. + 'REST API has no way to issue tokens (see issue #93).' + ); + } + + public function test_authenticated_user_can_reach_the_api_tokens_page(): void + { + $this->actingAs($user = User::factory()->withPersonalTeam()->create()); + + $response = $this->get('/user/api-tokens'); + + $response->assertOk(); + } +}