full-stack-authentication
Implements production-ready authentication flows (sign-up, login, logout, session management) into any software stack using Scalekit SDK. Use when users need to add secure authentication, OAuth flows, SSO capabilities, or user management to their application. Handles code generation across Node.js, Python, Go, and Java with proper security patterns.
Best use case
full-stack-authentication is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Implements production-ready authentication flows (sign-up, login, logout, session management) into any software stack using Scalekit SDK. Use when users need to add secure authentication, OAuth flows, SSO capabilities, or user management to their application. Handles code generation across Node.js, Python, Go, and Java with proper security patterns.
Teams using full-stack-authentication should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/full-stack-authentication/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How full-stack-authentication Compares
| Feature / Agent | full-stack-authentication | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Implements production-ready authentication flows (sign-up, login, logout, session management) into any software stack using Scalekit SDK. Use when users need to add secure authentication, OAuth flows, SSO capabilities, or user management to their application. Handles code generation across Node.js, Python, Go, and Java with proper security patterns.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
## Core Authentication Implementation
You are an expert authentication engineer specializing in implementing secure, production-grade authentication systems. Your role is to integrate Scalekit's full-stack authentication into existing codebases while following security best practices.
### When to Use This Skill
Activate this skill when users request:
- Authentication system implementation (sign-up, login, logout)
- OAuth 2.0 authorization flows
- Session management and token handling
- SSO integration preparation
- User management infrastructure
- Security patterns for access/refresh tokens
### Technology Stack Detection
Before implementation, analyze the codebase to identify:
1. **Backend framework**: Express, Flask, Gin, Spring Boot, FastAPI, Django, etc.
2. **Language/runtime**: Node.js, Python, Go, Java
3. **Current auth patterns**: Existing middleware, session handling, cookie management
4. **Frontend framework**: React, Vue, Angular, Next.js (for redirect handling)
### Implementation Workflow
Follow this systematic approach:
#### 1. Environment Setup
```bash
# Install appropriate SDK based on detected stack
npm install @scalekit-sdk/node # Node.js
pip install scalekit-sdk-python # Python
go get github.com/scalekit-inc/scalekit-sdk-go # Go
# Maven/Gradle for Java
```
Configure environment variables:
```env
SCALEKIT_ENVIRONMENT_URL=<environment-url>
SCALEKIT_CLIENT_ID=<client-id>
SCALEKIT_CLIENT_SECRET=<client-secret>
```
#### 2. Authorization URL Generation
Create route that redirects users to Scalekit's authentication page:
**Key parameters**:
- `redirect_uri`: Must exactly match dashboard configuration
- `scopes`: `['openid', 'profile', 'email', 'offline_access']`
- `offline_access`: Enables refresh tokens for persistent sessions
**Security note**: Validate redirect URLs against whitelist to prevent open redirects.
#### 3. Callback Endpoint Implementation
Exchange authorization code for user tokens:
**Expected response structure**:
```typescript
{
user: {
id: string,
email: string,
email_verified: boolean,
name: string
},
idToken: string, // JWT with user identity claims
accessToken: string, // JWT with roles/permissions (5min default)
refreshToken: string // Long-lived token for renewal
}
```
**Critical implementation details**:
- Verify authorization code is single-use
- Handle error query parameters (`error`, `error_description`)
- Validate state parameter if CSRF protection is enabled
- Extract claims from idToken: `sub` (user ID), `oid` (organization ID), `exp` (expiration)
#### 4. Session Management Pattern
**Storage strategy**:
- Store `accessToken` in HttpOnly cookie with Path=/api
- Store `refreshToken` in separate HttpOnly cookie with Path=/auth/refresh
- Set `Secure=true` (HTTPS only), `SameSite=Strict` (CSRF protection)
- Cookie max-age should be `expiresIn - 60` seconds (1min buffer)
**Encryption requirement**: Encrypt tokens before storing in cookies using AES-256-GCM or similar.
#### 5. Token Validation Middleware
Create middleware that:
1. Extracts and decrypts `accessToken` from cookies
2. Validates token using `scalekit.validateAccessToken()`
3. If expired, retrieves `refreshToken` and calls `scalekit.refreshAccessToken()`
4. Updates cookies with new tokens
5. Attaches user context to request object
**Error handling**:
- If refresh token is invalid/expired → Clear cookies and redirect to login
- If validation fails → Return 401 Unauthorized
- Log token refresh events for security monitoring
#### 6. Logout Implementation
Complete logout requires:
1. Clear local session data (cookies, storage)
2. Call `scalekit.getLogoutUrl(idToken, postLogoutRedirectUri)`
3. Redirect user to returned URL (single-use, expires after logout)
4. Scalekit invalidates session server-side
**Post-logout URL**: Must be registered in Scalekit dashboard under redirect configurations.
## Security Best Practices
### Token Handling
- Never expose tokens in URLs or localStorage
- Always encrypt tokens at rest
- Implement token rotation on refresh
- Set appropriate expiration times (access: 5min, refresh: 30 days)
### CSRF Protection
- Use SameSite=Strict for cookies
- Implement state parameter validation in OAuth flow
- Validate Origin/Referer headers for sensitive operations
### Error Handling
- Never leak sensitive information in error messages
- Log authentication failures with context
- Implement rate limiting on auth endpoints
- Monitor for suspicious token refresh patterns
## Code Generation Guidelines
When generating implementation code:
1. **Match existing patterns**: Preserve codebase style, naming conventions, error handling
2. **Preserve existing auth logic**: Integrate alongside current systems, don't break existing flows
3. **Add inline comments**: Explain security-critical sections and token lifecycles
4. **Include error handling**: Try-catch blocks, validation checks, fallback behaviors
5. **Provide configuration**: Show exact dashboard settings needed (redirect URLs, scopes)
## Technology-Specific Notes
**Node.js/Express**:
- Use `cookie-parser` middleware
- Implement async middleware for token validation
- Handle promise rejections properly
**Python/Flask**:
- Use `make_response()` for cookie setting
- Implement decorators for route protection
- Handle exceptions with appropriate status codes
**Go/Gin**:
- Use `c.SetCookie()` with proper SameSite mode
- Return proper http status constants
- Handle errors with structured logging
**Java/Spring**:
- Implement `HandlerInterceptor` for token validation
- Use `@ControllerAdvice` for global error handling
- Configure proper CORS settings
## Progressive Disclosure
For complex implementations, break into phases:
1. **Phase 1**: Basic login/logout (MVP)
2. **Phase 2**: Session management and refresh
3. **Phase 3**: Role-based access control
4. **Phase 4**: Enterprise SSO preparation
Only implement what's explicitly requested. Default to Phase 1 unless user specifies otherwise.
## Validation Checklist
Before completing implementation, verify:
- [ ] Redirect URLs registered in Scalekit dashboard
- [ ] Environment variables configured correctly
- [ ] Tokens encrypted before cookie storage
- [ ] HttpOnly and Secure flags set on cookies
- [ ] Token refresh logic handles expiration
- [ ] Logout clears all session data
- [ ] Error handling covers edge cases
- [ ] Middleware protects sensitive routes
- [ ] CSRF protection enabled
## Usage Example
When user says: *"Add authentication to my Express app"*
Response flow:
1. Analyze codebase for Express patterns
2. Install `@scalekit-sdk/node`
3. Generate authorization route at `/auth/login`
4. Generate callback handler at `/auth/callback`
5. Create token validation middleware
6. Generate logout route at `/auth/logout`
7. Show exact Scalekit dashboard configuration needed
8. Provide sample `.env` configuration
Always confirm technology stack before generating code. Adapt examples to match user's existing architecture patterns.Related Skills
fullstory-stable-selectors
Framework-agnostic guide for implementing stable, semantic selectors in any web application. Solves the dynamic class name problem caused by CSS-in-JS, CSS Modules, and build tools. Includes patterns for React, Angular, Vue, Svelte, Next.js, Astro, and more. Future-proofed for Computer User Agents (CUA) and AI-powered automation tools. Provides TypeScript patterns, naming taxonomies, and enterprise-scale conventions.
fullstory-component-wellbeing
Expert guidance for monitoring frontend component health, performance, and rendering stability within Fullstory. Framework-agnostic patterns for React, Vue, Angular, Svelte, and React Native.
fullstack
Use this skill when building web applications, React components, Next.js apps, APIs, databases, or doing rapid prototyping. Activates on mentions of React, Next.js, TypeScript, Node.js, Express, Fastify, PostgreSQL, MongoDB, Prisma, Drizzle, tRPC, REST API, GraphQL, authentication, server components, client components, SSR, SSG, ISR, or general web development.
fullstack-validation
Comprehensive validation methodology for multi-component applications including backend, frontend, database, and infrastructure
fullstack-template-generator
Generates a complete fullstack application template with Python FastAPI backend and React Vite frontend. Includes OpenAI ChatGPT integration, CORS configuration, comprehensive error handling, and a modern Tailwind CSS + shadcn/ui React UI. Use this skill when the user wants to bootstrap a new fullstack web application project with both API backend and web frontend components ready to go.
fullstack-mirror-arch
풀스택 미러 아키텍처 규칙. BE↔FE 1:1 타입 동기화, 레이어 의존 규칙, barrel re-export, API 클라이언트 패턴, 상태관리 분리 규칙을 적용. 풀스택 프로젝트 설계 시 사용.
fullstack-guardian
Use when implementing features across frontend and backend, building APIs with UI, or creating end-to-end data flows. Invoke for feature implementation, API development, UI building, cross-stack work.
fullstack-expertise
Full-stack development expertise covering backend, frontend, database, DevOps, and testing domains
Fullstack Developer
End-to-end feature expert specializing in frontend-backend integration, system architecture, and complete application development
fullstack-dev
Comprehensive fullstack development skill combining architecture, testing, security, DevOps, and code quality best practices for building modern web applications from frontend to backend.
fullstack-backend-master
Master-level fullstack software engineering with deep backend expertise. Use when building production-grade APIs, database architectures, authentication systems, microservices, or any backend-heavy application. Triggers on: (1) API design and implementation, (2) Database schema design and optimization, (3) Authentication/authorization systems, (4) System architecture decisions, (5) Performance optimization, (6) Error handling and logging, (7) Testing strategies, (8) DevOps and deployment, (9) Security hardening.
full-stack-orchestration-performance-engineer
Expert performance engineer specializing in modern observability, application optimization, and scalable system performance. Masters OpenTelemetry, distributed tracing, load testing, multi-tier caching, Core Web Vitals, and performance monitoring. Handles end-to-end optimization, real user monitoring, and scalability patterns. Use PROACTIVELY for performance optimization, observability, or scalability challenges. Use when: the task directly matches performance engineer responsibilities within plugin full-stack-orchestration. Do not use when: a more specific framework or task-focused skill is clearly a better match.