nocobase-app-plugin-api-keys
O que ela faz
Esta skill adiciona acesso por chave de API a um app NocoBase, para que scripts e outros sistemas possam chamar a API dele. Ela é indicada para desenvolvedores que conectam ferramentas externas a um app NocoBase.
Quando usar
- ✓Quando um script ou integração precisa chamar a API do seu app NocoBase.
- ✓Quando uma chave de API emitida pelo app está sendo recusada.
- ✓Quando você precisa de chaves de API que atuem como um usuário específico, com as funções desse usuário.
Link da skill
https://github.com/nocobase/nocobase/blob/v3-develop/packages/plugins/app-plugin-api-keys/skills/nocobase-app-plugin-api-keys/SKILL.mdCopie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.
Como usar
O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.
Mensagem pronta para colar
Para Claude Code, Codex ou Cursor: rode na pasta do projeto e a skill fica instalada.
Baixe o SKILL.md e coloque na pasta de skills do seu agente.
Exemplo do que pedir para a IA
“Você pode adicionar acesso por chave de API ao meu app NocoBase para que meu script noturno possa chamar a API dele?”
5 skills novas por semana. 1 minuto de leitura.
Como funciona
A IA registra o plugin API Keys e a tabela de banco de dados dele. Cada chave é associada à sessão do dono, para que o script atue com as funções desse usuário.
Conteúdo técnico (SKILL.md original)
Texto original do autor, em inglês, direto do GitHub.
API Keys App Plugin
Use this Skill when an App needs non-interactive callers — a script, a cron job,
a third-party integration — to reach its API as a real user, or when a key the
App issued is being rejected. The default configuration resolves a key into its owner’s Session and carries that user’s roles. Applications needing scoped credentials must use a separate configuration with enableSessionForAPIKeys: false and enforce their business rules on the server.
This package is Better Auth's
API Key plugin plus the
apikey migration. apiKey is wrapped
only to supply three defaults, all overridable; its name, options and behaviour
are Better Auth's, and Better Auth's documentation applies unchanged.
Public surfaces
- Server plugin: default export of
@nocobase/app-plugin-api-keys/server. Contributes theapikeytable migration and nothing else. apiKey(options?), plusAPI_KEY_TABLE_NAME,API_KEY_ERROR_CODESand the option types, from the same entry. Use these rather than adding@better-auth/api-keyto the App: the migration here matches the schema this version declares, and taking both from one package keeps them in step.- Client registration factory:
@nocobase/app-plugin-api-keys/client. It contributes no pages. apiKeyClient, re-exported from@better-auth/api-key/clientby the same entry.ApiKeySummaryand the expiry helpers, for the App's own key management page. Such a page readsuseAuthenticationClient().apiKey, typed through the authentication plugin'sAuthClientPluginRegistry, and is declared among the App's own routes.- HTTP API:
POST /api/auth/api-key/create,GET /api/auth/api-key/list,GET /api/auth/api-key/get,POST /api/auth/api-key/update, andPOST /api/auth/api-key/delete. All five act only on the caller's own keys.
The plugin contributes no NocoBase route of its own. The endpoints above are
Better Auth's, mounted by Authentication's /api/auth/* handler. Its server registers one thing: the access check that lets a valid key read the App's API document.
Register it
Both halves are required, and each fails differently on its own.
- Add the default export to the App's
server/plugins.tsandclient/plugins.ts. - Add
apiKey()topluginsinserver/config/auth.ts, andapiKeyClient()topluginsinclient/config/auth.ts. - Run
pnpm nocobase db apply.
Only step 1 leaves the apikey table created and no endpoints mounted. Only
step 2 mounts endpoints against a table that does not exist, and every call
fails at the database.
The three defaults
apiKey() supplies enableSessionForAPIKeys: true, rateLimit: { enabled: false } and requireName: true, so an App normally passes nothing.
enableSessionForAPIKeys is the one that has to be set. Better Auth defaults
it off, and with it off a key authenticates nothing: keys are still
issued, and every request carrying one answers 401. Nothing points at the
configuration, so do not override it without meaning to.
rateLimit is off because Better Auth's own default is 10 requests per key per
day, which is a quota for issuing keys rather than for using them. Pass
{ enabled: true, maxRequests: 1000, timeWindow: 60_000 } for a quota the App
actually wants.
All three are overridable, and passing all three back reproduces Better Auth's own behaviour exactly.
Call the API with a key
curl -H 'x-api-key: <key>' https://example.com/api/orders
An App route needs no change. auth.required() and auth.optional() resolve
the key into the owner's Session, and Authorization then evaluates that user's
roles. Read context.get('auth') exactly as for a cookie Session.
Pass apiKeyHeaders: ['x-api-key', 'authorization-key'] to accept a different
header.
To find out what the App's API offers, read its OpenAPI document with the same key: GET /api/swagger returns the JSON document and GET /api/swagger/docs the Swagger UI page. A signed-in session or a valid key may read it; anything else gets 401 with error.reason API_DOCS_UNAUTHENTICATED. The API key endpoints are listed there under /api/auth/api-key/..., tagged Authentication.
What a key can reach, and what it cannot
A key is its owner, so it reaches the Better Auth endpoints a Session reaches.
Verified against @better-auth/api-key 1.7.1 with only an x-api-key header:
| Endpoint
Perguntas frequentes
Como um script envia a chave?
Ele envia a chave no cabeçalho x-api-key em cada requisição.
Uma chave pode ter permissões limitadas?
Não com a configuração padrão, que carrega as funções do dono. A skill descreve uma configuração separada para chaves com escopo.
Ele adiciona uma página de login?
Não. Ele apenas adiciona acesso por chave de API.
Detalhes
Descrição original do autor
Register the API Keys plugin in a NocoBase App, let scripts and integrations call the App's API with an x-api-key header, or work out why a key is rejected.
repo: nocobase/nocobase
Popularidade
- Estrelas no GitHub
- 25 mil
- Posição no ranking
- #10088
- Licença
- —
- Atualizada em
- 02/11/2026
Comentários
- …
Mais skills deste repositório
nocobase-app-development
25 milAjuda seu agente a criar páginas, rotas, dados, permissões e testes para uma aplicação de negócios completa no NocoBase 3.
shadcn
25 milAjuda seu agente a encontrar, adicionar, corrigir e estilizar componentes shadcn/ui em um projeto web, usando a documentação oficial e os registros deles.
nocobase-app-plugin-development
25 milAjuda seu agente a criar e manter plugins do NocoBase 3 dentro de um app existente, incluindo as partes de servidor, cliente, banco de dados e registro.
nocobase-app-upgrade
25 milAjuda seu agente a atualizar um app NocoBase para uma versão mais nova do template, trazendo as mudanças do template e mantendo o seu trabalho.
Skills parecidas
reverse-engineer-anything
422 milAjuda seu agente a analisar apps e pacotes já publicados para explicar recursos, comparar versões ou orientar uma reconstrução, usando a ferramenta REA.
1password
394 milAjuda seu agente a configurar a CLI do 1Password, fazer login e ler ou injetar segredos sem imprimir seus valores no chat.
healthcheck
394 milAjuda seu agente a auditar o computador ou servidor que roda o OpenClaw em busca de riscos como SSH, firewall, atualizações e backups, com correções seguras.