api-authentication

Solid

Secure API authentication with JWT, OAuth 2.0, API keys. Use for authentication systems, third-party integrations, service-to-service communication, or encountering token management, security headers, auth flow errors.

API & Backend 160 stars 25 forks Updated 2 weeks ago MIT

Install

View on GitHub

Quality Score: 88/100

Stars 20%
73
Recency 20%
90
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# API Authentication Implement secure authentication mechanisms for APIs using modern standards and best practices. ## Authentication Methods | Method | Use Case | Security Level | |--------|----------|----------------| | JWT | Stateless auth, SPAs | High | | OAuth 2.0 | Third-party integration | High | | API Keys | Service-to-service | Medium | | Session | Traditional web apps | High | ## JWT Implementation (Node.js) ```javascript const jwt = require('jsonwebtoken'); const generateTokens = (user) => ({ accessToken: jwt.sign( { userId: user.id, role: user.role }, process.env.JWT_SECRET, { expiresIn: '15m' } ), refreshToken: jwt.sign( { userId: user.id, type: 'refresh' }, process.env.REFRESH_SECRET, { expiresIn: '7d' } ) }); const authMiddleware = (req, res, next) => { const authHeader = req.headers.authorization; // Validate authorization header format if (!authHeader || !authHeader.startsWith('Bearer ')) { return res.status(401).json({ error: 'Malformed authorization header' }); } const parts = authHeader.split(' '); if (parts.length !== 2) { return res.status(401).json({ error: 'Malformed authorization header' }); } const token = parts[1]; if (!token) { return res.status(401).json({ error: 'No token provided' }); } try { req.user = jwt.verify(token, process.env.JWT_SECRET); next(); } catch (err) { res.status(401).json({ error: 'Invalid token' }); } }; ``` ## Security Requirements ...

Details

Author
secondsky
Repository
secondsky/claude-skills
Created
6 months ago
Last Updated
2 weeks ago
Language
TypeScript
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

API & Backend Listed

auth-implementation-patterns

Master authentication and authorization patterns including JWT, OAuth2, session management, and RBAC to build secure, scalable access control systems. Use when implementing auth systems, securing APIs, or debugging security issues.

21 Updated 5 days ago
HermeticOrmus
API & Backend Listed

auth-implementation-patterns

Master authentication and authorization patterns including JWT, OAuth2, session management, and RBAC to build secure, scalable access control systems. Use when implementing auth systems, securing APIs, or debugging security issues.

0 Updated today
CodeWithBehnam
AI & Automation Featured

building-api-authentication

Build secure API authentication systems with OAuth2, JWT, API keys, and session management. Use when implementing secure authentication flows. Trigger with phrases like "build authentication", "add API auth", or "secure the API".

2,266 Updated today
jeremylongshore
API & Backend Listed

security-auth

Authentication and authorization patterns for secure access control. Use when: (1) Implementing JWT authentication, (2) OAuth2/OIDC integration, (3) Building RBAC/ABAC systems, (4) Session management, (5) MFA implementation. Auto-detects: auth, jwt, oauth, oidc, rbac, abac, permission, session, token, refresh, login, password, mfa, 2fa

0 Updated today
murtazatouqeer
AI & Automation Listed

auth-implementation-patterns

Master authentication and authorization patterns including JWT, OAuth2, session management, and RBAC to build secure, scalable access control systems. Use when implementing auth systems, securing APIs, or debugging security issues.

1 Updated today
Mohammadibrahim55