Custom Hook Flow Implementation
Use this model when API key management belongs inside your core product settings.Hooks involved
useApiAuthAppSession(ticket)for session bootstrap.useApiAuthKeys({ status })for key CRUD lifecycle.- API Auth audit hooks for operational views.
Session bootstrap pattern
Key lifecycle panel
Required UX safeguards
- Confirm dialog before revoke.
- Clear warning before rotate.
- One-time secret modal with explicit acknowledgment.
- Error handling with actionable retry.
- Disabled actions while mutation in flight.
Performance and consistency
- Refetch list after create/rotate/revoke.
- Keep optimistic updates minimal for security-sensitive actions.
- Handle 401/403 by returning user to access gate.
Testing checklist
- Ticket missing: UI blocks correctly.
- Expired ticket: exchange fails cleanly.
- Rotate returns new secret and old secret is rejected.
- Revoke removes active status immediately.
Code examples from repo
1) Ticket exchange in session hook (react-sdk/jsx/lib/hooks/use-api-auth-app.ts)
2) Key lifecycle operations (react-sdk/jsx/lib/hooks/use-api-auth-keys.ts)
3) API reference
Use API Keys Backend API Reference only when you need direct server-to-server calls outside the SDK hook flow.Go-live checklist
- RBAC gate for ticket issuance is enforced server-side.
- Ticket expiry is short and validated.
- Key create/rotate/revoke flows verified in staging.
- Audit logs visible to support/security owners.
- Customer-facing key handling docs are published.
