nocobase-app-plugin-authentication
Was er macht
Dieser Skill führt bei der Frage, wer angemeldet ist, in einer NocoBase-3-App mit Better Auth. Er ist für Entwickler, die Seiten schützen, den Login anpassen oder eine Anmeldemethode ergänzen.
Wann du ihn nutzt
- ✓Wenn du eine API-Route oder Seite schützen musst, sodass nur angemeldete Nutzer sie verwenden können.
- ✓Wenn du deiner App eine Anmeldung über ein soziales Konto oder OIDC hinzufügen möchtest.
- ✓Wenn du die Login-, Registrierungs- oder Passwortseiten anpassen willst.
Link zum Skill
https://github.com/nocobase/nocobase/blob/v3-develop/packages/plugins/app-plugin-authentication/skills/nocobase-app-plugin-authentication/SKILL.mdKopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.
So nutzt du ihn
Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.
Fertige Nachricht zum Einfügen
Für Claude Code, Codex oder Cursor: Führe den Befehl in deinem Projektordner aus, dann wird der Skill installiert.
Lade die SKILL.md herunter und lege sie in den Skills-Ordner deines Agenten.
Beispielanfrage an deine KI
“Kannst du meiner NocoBase-App eine Google-Anmeldung hinzufügen und dafür sorgen, dass die Admin-Seite einen angemeldeten Nutzer verlangt?”
5 neue Skills pro Woche. 1 Minute Lesezeit.
So funktioniert es
Die KI fügt die Anmeldemethode über die Better-Auth-Konfiguration hinzu und schützt die Routen anhand der Session. Danach passt sie die Anmeldeseiten bei Bedarf an.
Technischer Inhalt (originale SKILL.md)
Originaltext des Autors, auf Englisch, direkt von 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:
authenticationTokenresolves theAuthinstance:required(),optional(),getSession(headers),handler(request),signInUser(userId, request).AuthEnvtypes a Hono router whose routes readcontext.get('auth').userAdministrationServiceTokenresolvesUserAdministrationService:list,get,create,update,disable,enable,resetPassword,revokeSessions,withConnection; errors areUserAdministrationError.AuthConfigis Better Auth'sBetterAuthOptions, the type of the application'sserver/config/auth.ts. User initialization configuration lives separately underusers.initialAdmin.createAuthentication,databaseAdapter,createAuthStoragebuild an instance outside the application runtime, mainly in tests.
Client, from @nocobase/app-plugin-authentication/client:
authentication()is the registration factory. It takes no options, contributes no routes, and mounts one React provider.useAuthentication()returns{ client, session, isPending, refresh };useAuthenticationClient()returns the Better Auth client alone.RequiredAuthentication,GuestAuthentication, andAuthenticationGuard({ mode })gate a route subtree on the session.AuthConfigis Better Auth's client options, the type of the application'sclient/config/auth.ts.authenticationClientTokenis 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. There
is no other authentication REST surface.
API document: the plugin lets a signed-in session read the App's OpenAPI document at GET /api/swagger and its Swagger UI at GET /api/swagger/docs; an anonymous request gets 401 with error.reason API_DOCS_UNAUTHENTICATED, and @nocobase/app-plugin-api-keys adds API keys as a second way in. The plugin also merges Better Auth's endpoints into that document from Better Auth's own OpenAPI generator, at their full /api/auth/... paths and tagged Authentication, so a Better Auth plugin added to auth.plugins is documented without further work. Browser-only steps are left out: /sign-in/social, /link-social, /callback/{id}, /verify-email, /reset-password/{token}, /delete-user/callback and /error. Do not add Better Auth's openAPI() plugin: it would publish its own unauthenticated /api/auth/reference page and schema route.
Choose the task path
| The task is | Read | | ---------------------------------------------------
Häufige Fragen
Legt das fest, was Nutzer tun dürfen?
Nein. Was ein angemeldeter Nutzer darf, deckt der Autorisierungs-Skill ab.
Kann ich Zwei-Faktor-Anmeldung oder Passkeys hinzufügen?
Ja. Der Skill behandelt die Aktivierung offizieller Better-Auth-Plugins wie Two-Factor und Passkeys.
Ändert es den Code des Plugins?
Nein. Alle Änderungen gehen in deine Anwendung.
Details
Originalbeschreibung des Autors
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.
repo: nocobase/nocobase
Beliebtheit
- GitHub-Sterne
- 25k
- Platz im Ranking
- #10089
- Lizenz
- —
- Aktualisiert
- 2.11.2026
Kommentare
- …
Weitere Skills aus diesem Repository
nocobase-app-development
25kHilft deinem Agenten, Seiten, Routen, Daten, Berechtigungen und Tests für eine vollständige NocoBase-3-Geschäftsanwendung zu bauen.
shadcn
25kHilft deinem Agenten, shadcn/ui-Komponenten in einem Webprojekt zu finden, hinzuzufügen, zu reparieren und zu gestalten, mit den offiziellen Dokumenten und Registern.
nocobase-app-plugin-development
25kHilft deinem Agenten, NocoBase-3-Plugins in einer bestehenden App zu erstellen und zu pflegen, einschließlich Server-, Client-, Datenbank- und Registrierungsteilen.
nocobase-app-upgrade
25kHilft deinem Agenten, eine NocoBase-App auf eine neuere Vorlagenversion zu aktualisieren, Vorlagenänderungen zu übernehmen und deine eigenen Arbeiten zu behalten.
Ähnliche Skills
reverse-engineer-anything
422kHilft deinem Agenten, fertige Apps und Pakete zu untersuchen, um Funktionen zu erklären, Versionen zu vergleichen oder einen Nachbau zu leiten, mit dem REA-Tool.
1password
394kHilft deinem Agenten, die 1Password-Kommandozeile einzurichten, sich anzumelden und Geheimnisse zu lesen oder einzufügen, ohne deren Werte im Chat auszugeben.
healthcheck
394kHilft deinem Agenten, den Computer oder Server, auf dem OpenClaw läuft, auf Sicherheitsrisiken wie SSH, Firewall, Updates und Backups zu prüfen und sichere Korrekturen vorzuschlagen.