Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

nocobase-app-plugin-authentication

БесплатноБез исполняемых скриптовНе проверен

Build authentication requirements in a NocoBase 3 application: protect API routes and pages with the session, read and refresh the session in the browser…

nocobaseот nocobase★ 25 082 звезды на GitHub

Об этом скилле

Authentication development

Use this Skill when an application built on @nocobase/app-plugin-authentication needs anything about who the caller is: protecting a route or page, reading the current user, changing the sign-in pages, adding a sign-in method, disabling accounts, or preparing authentication for deployment.

Do not use it for what a signed-in user may do — that is nocobase-app-plugin-authorization — or for the user administration page, which is nocobase-app-plugin-users. Do not modify the plugin's own source, migrations, or dist/; everything below is done in the application.

The plugin wraps Better Auth. Application configuration is Better Auth configuration, and every Better Auth plugin, social provider, and hook is available through it. Read the installed Better Auth version's documentation for option details; this Skill covers where those options go in a NocoBase application and what the plugin adds on top.

Enable an official Better Auth plugin before writing anything of your own: device login for a CLI (deviceAuthorization() with bearer()), organizations, two-factor and passkeys all exist upstream, and each needs only configuration, an application migration for its tables, and its UI. Enabling an official Better Auth plugin covers the rule, the schema check and the migration.

Public surfaces

Server, from @nocobase/app-plugin-authentication (the root entry is the server entry) or @nocobase/app-plugin-authentication/server:

  • authenticationToken resolves the Auth instance: required(), optional(), getSession(headers), handler(request), signInUser(userId, request).
  • AuthEnv types a Hono router whose routes read context.get('auth').
  • userAdministrationServiceToken resolves UserAdministrationService: list, get, create, update, disable, enable, resetPassword, revokeSessions, withConnection; errors are UserAdministrationError.
  • AuthConfig is Better Auth's BetterAuthOptions, the type of the application's server/config/auth.ts. User initialization configuration lives separately under users.initialAdmin.
  • createAuthentication, databaseAdapter, createAuthStorage build an instance outside the application runtime, mainly in tests.

Client, from @nocobase/app-plugin-authentication/client:

  • authentication() is the registration factory. It mounts one React provider and registers two settings pages, so the application declares neither:
    • System settings › Accounts › Authentication (/settings/authentication, route id AUTHENTICATION_SETTINGS_ROUTE_ID), read-only, behind the authentication.settings settings item's read action, with its single sign-on guide at /settings/authentication/sso (AUTHENTICATION_SSO_GUIDE_ROUTE_ID) and the two-factor and passkey guides at /settings/authentication/two-factor (AUTHENTICATION_TWO_FACTOR_GUIDE_ROUTE_ID) and /settings/authentication/passkey (AUTHENTICATION_PASSKEY_GUIDE_ROUTE_ID).
    • Personal settings › Account › Account and security (/me/security, ACCOUNT_SECURITY_ROUTE_ID), open to every signed-in person: sign-in details, change password, signed-in devices (command-line sign-ins included) and linked single sign-on or social accounts, all through Better Auth's own endpoints.
    • authentication({ signInButtons: ['github'] }) names the providers the application's sign-in page shows a button for; the settings page lists only those as sign-in page entries and marks other configured providers as having no button.
    • Replace a whole page with authentication({ settingsComponentLoader, accountSecurityComponentLoader }), or with routeComponentOverrides naming the route ids above. See client session and pages.
  • useAuthentication() returns { client, session, isPending, refresh }; useAuthenticationClient() returns the Better Auth client alone.
  • RequiredAuthentication, GuestAuthentication, and AuthenticationGuard({ mode }) gate a route subtree on the session.
  • AuthConfig is Better Auth's client options, the type of the application's client/config/auth.ts.
  • authenticationClientToken is the client's service token, used to stub the client in component tests.

Headless actions, from @nocobase/app-plugin-authentication/client/actions: usePasswordLogin, usePasswordRegistration, usePasswordResetRequest, usePasswordReset, each returning { submit, isPending, error }.

HTTP: every Better Auth endpoint is served under /api/auth/* by the plugin's own route. A Better Auth plugin's endpoints appear there automatically. Besides it the plugin serves three read-only routes: the public GET /api/authentication/capabilities (whether password reset is available); GET /api/authentication/settings, the effective sign-in settings, where each comes from (env with the variable's name, file for config.yml, code, or default) and the

Полный SKILL.md на GitHub

Установить nocobase-app-plugin-authentication в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/adding-sign-in-methods.mdreferences/authentication-email.mdreferences/better-auth-plugins.mdreferences/client-session-and-pages.mdreferences/custom-better-auth-plugin.mdreferences/protecting-routes.mdreferences/user-lifecycle-and-deployment.md

FAQ

Что делает скилл nocobase-app-plugin-authentication?

Build authentication requirements in a NocoBase 3 application: protect API routes and pages with the session, read and refresh the session in the browser, customize the login, registration and password pages, add sign-in methods such as social login, OIDC or a custom Better Auth plugin, enable official Better Auth plugins (device login for a CLI, bearer tokens, organizations, two-factor, passkeys) with the migration their tables need, manage account lifecycle from server code, and configure secrets, cookies and shared storage for deployment.

Как установить скилл nocobase-app-plugin-authentication?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл nocobase-app-plugin-authentication запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить nocobase-app-plugin-authentication с