Skip to content

feat: API token management in workspace settings#10624

Open
dnplkndll wants to merge 3 commits intohcengineering:developfrom
ledoent:feat/api-token-management
Open

feat: API token management in workspace settings#10624
dnplkndll wants to merge 3 commits intohcengineering:developfrom
ledoent:feat/api-token-management

Conversation

@dnplkndll
Copy link

@dnplkndll dnplkndll commented Mar 11, 2026

Summary

  • Add full API token CRUD (create, list, revoke) as a new workspace settings page
  • Tokens are workspace-scoped JWTs with configurable expiry (7–365 days), stored in a new api_tokens table
  • New createApiToken, listApiTokens, revokeApiToken account service RPC methods
  • Frontend: settings page with token list, status badges, create popup with one-time token reveal

Changes

Backend (server/account/):

  • ApiToken type + apiToken DB collection (Postgres V25 migration + Mongo)
  • Three new RPC methods registered in AccountMethods and getMethods()
  • AccountClient interface + implementation extended

Frontend (plugins/setting-resources/):

  • ApiTokens.svelte — workspace settings page (Owner role)
  • ApiTokenCreatePopup.svelte — creation modal with workspace/expiry selection
  • Registered as WorkspaceSettingCategory in the model

Test plan

  • Create an API token from workspace settings → token appears in list
  • Copy token from one-time reveal popup → verify JWT decodes correctly
  • Use minted token with transactor REST API (/api/v1/find-all/{workspace})
  • Revoke a token → status changes to "revoked"
  • Token list shows correct status (active/expiring/revoked/expired)
  • V25 migration creates api_tokens table on fresh and existing databases

Ref: #10622

🤖 Generated with Claude Code

@huly-github-staging
Copy link

Connected to Huly®: UBERF-15850

dnplkndll and others added 3 commits March 12, 2026 19:59
Add full API token CRUD (create, list, revoke) as a new workspace
settings page. Tokens are workspace-scoped JWTs with configurable
expiry (7-365 days), stored in a new `api_tokens` DB table.

Backend:
- New `ApiToken` type and `apiToken` DB collection (Postgres + Mongo)
- V25 migration creates `api_tokens` table with FK constraints
- `createApiToken`, `listApiTokens`, `revokeApiToken` RPC methods
- AccountClient methods for all three operations

Frontend:
- `ApiTokens.svelte` — settings page with token list and status badges
- `ApiTokenCreatePopup.svelte` — modal for creating tokens with
  workspace selection, name, and expiry configuration
- One-time token reveal after creation with copy-to-clipboard
- Registered as WorkspaceSettingCategory (Owner role required)

Ref: hcengineering#10622

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Don Kendall <kendall@donkendall.com>
Documents existing transactor endpoints (find-all, tx, load-model),
account service JSON-RPC, and the new API token management endpoints.
Includes operationIds for codegen and bearerAuth/serverSecret security
schemes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Don Kendall <kendall@donkendall.com>
Add a collapsible documentation section below the token list that shows
available REST API endpoints, base URL, and a curl example. Helps users
understand how to use their tokens for automation and integrations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Don Kendall <kendall@donkendall.com>
@dnplkndll dnplkndll force-pushed the feat/api-token-management branch from c84d786 to efdbe1b Compare March 13, 2026 01:59
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.

1 participant