मुख्य सामग्री पर जाएँ
Skillpedia
सिक्योरिटी25k · #10089

nocobase-app-plugin-authentication

यह क्या करती है

यह स्किल NocoBase 3 ऐप में कौन sign-in है, यह संभालने का काम Better Auth से करती है। यह उन डेवलपर्स के लिए है जो पेज सुरक्षित करना, login बदलना या नया sign-in तरीका जोड़ना चाहते हैं।

कब इस्तेमाल करें

  • ✓जब आपको API route या पेज ऐसा सुरक्षित करना हो कि केवल sign-in किए हुए users उसे इस्तेमाल करें।
  • ✓जब आप अपने ऐप में social login या OIDC sign-in जोड़ना चाहें।
  • ✓जब आप login, registration या password पेज अपने हिसाब से बदलना चाहें।

Skill का लिंक

https://github.com/nocobase/nocobase/blob/v3-develop/packages/plugins/app-plugin-authentication/skills/nocobase-app-plugin-authentication/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/nocobase/nocobase/blob/v3-develop/packages/plugins/app-plugin-authentication/skills/nocobase-app-plugin-authentication/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“क्या आप मेरे NocoBase ऐप में Google sign-in जोड़ सकते हैं और admin पेज को sign-in किए हुए user तक सीमित कर सकते हैं?”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

AI Better Auth कॉन्फ़िगरेशन के ज़रिए sign-in तरीका जोड़ता है और session का उपयोग करके routes सुरक्षित करता है। फिर ज़रूरत के अनुसार sign-in पेज अपने हिसाब से बदलता है।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे 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 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, 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. 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 | | ---------------------------------------------------

अक्सर पूछे जाने वाले सवाल

क्या यह तय करता है कि users क्या कर सकते हैं?

नहीं। sign-in किया हुआ user क्या कर सकता है, यह authorization स्किल के दायरे में आता है।

क्या मैं two-factor sign-in या passkeys जोड़ सकता हूँ?

हाँ। स्किल two-factor और passkeys जैसे आधिकारिक Better Auth plugins चालू करना बताती है।

क्या यह plugin का अपना कोड बदलता है?

नहीं। सारे बदलाव आपके application में जाते हैं।

जानकारी

लेखक का मूल विवरण

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

लोकप्रियता

GitHub स्टार
25k
रैंकिंग में स्थान
#10089
लाइसेंस
—
अपडेट की गई
2/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

nocobase-app-development

25k

यह आपके एजेंट को पूर्ण NocoBase 3 व्यावसायिक एप्लिकेशन के लिए पेज, routes, डेटा, अनुमतियाँ और टेस्ट बनाने में मदद करती है।

कोडिंगसामान्य कोडिंग

shadcn

25k

यह आपके एजेंट को वेब प्रोजेक्ट में shadcn/ui कंपोनेंट खोजने, जोड़ने, ठीक करने और स्टाइल करने में मदद करती है, उनके आधिकारिक दस्तावेज़ और registries का उपयोग करके।

कोडिंगवेबसाइट और UI (frontend)

nocobase-app-plugin-development

25k

यह आपके एजेंट को मौजूदा NocoBase 3 ऐप के भीतर plugins बनाने और उनकी देखभाल करने में मदद करती है, जिसमें server, client, database और registration के हिस्से शामिल हैं।

कोडिंगAPI और सर्वर (backend)

nocobase-app-upgrade

25k

यह आपके एजेंट को NocoBase ऐप को नए template रिलीज़ तक अपग्रेड करने में मदद करती है, template के बदलाव लाते हुए आपका अपना काम बनाए रखते हुए।

कोडिंगडिप्लॉय और क्लाउड (DevOps)

मिलती-जुलती skills