कंटेंट पर जाएँ
TakoAPI
स्किल्स पर वापस

secure-auth-patterns

brandonwise द्वारा

Security & Passwords
441clawskills.sh द्वारा बताए गए डाउनलोड
0व्यूज़
0 लाइकइस स्किल को लाइक करने के लिए साइन इन करें
—अभी तक कोई रेटिंग नहीं
आपकी रेटिंग

संक्षिप्त

Master authentication and authorization patterns including JWT, OAuth2, session management, and RBAC to build.

विवरण

यह स्किल क्या करती है

Covers JWT with refresh tokens, session-based auth, OAuth2/social login, and role-based access control for TypeScript/Node.js backends. Includes working middleware for authentication, RBAC enforcement, resource ownership checks, and password hashing. Targets REST and GraphQL API implementations.

Combines JWT, OAuth2, session management, and RBAC into one reference with production-ready TypeScript code, so you don't have to cross-reference multiple separate guides.

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

  • Adding JWT auth to a new Express API
  • Integrating Google login into an existing app
  • Restricting admin-only routes with role checks
  • Replacing stateful sessions with token-based auth
  • Debugging 401 and 403 errors in an API

उदाहरण वर्कफ़्लो

इनपुट

User asks: Add JWT authentication with role-based access control to my Express API

एजेंट
  1. 1

    Generates token creation logic with short-lived access tokens and database-backed refresh tokens using jsonwebtoken

  2. 2

    Implements authenticate middleware to verify Bearer tokens on protected routes

  3. 3

    Defines Role enum and roleHierarchy, then creates requireRole middleware

  4. 4

    Applies requireRole to sensitive endpoints like DELETE /api/users/:id

  5. 5

    Adds bcrypt password hashing and zod-based password validation

आउटपुट

Express routes with JWT issuance, a /api/auth/refresh endpoint, role-gated admin routes, and secure password handling

आवश्यकताएँ

  • Google Cloud OAuth credentials (GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET) — required for social login via Google
  • Redis instance — required for session storage and refresh token revocation

इंस्टॉलेशन

clawhub install brandonwise/secure-auth-patterns

CLI कमांड चलाएँ, या प्रॉम्प्ट को Claude Code, Cursor, Codex या जो भी कोडिंग एजेंट आप इस्तेमाल करते हैं उसमें पेस्ट करें।

लिंक