Api Authentication
Secure API authentication guide covering JWT, OAuth 2.0, and API keys with token handling and security headers.
- CCM score
- 53 of 100
- skills.sh installs
- 563
- GitHub stars
- 257
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers authentication methods compared by use case and security level: JWT, OAuth 2.0, API keys, and sessions
- Includes a Node.js JWT example with access and refresh token generation and a Bearer header validation middleware
- Enforces security requirements such as HttpOnly cookies over localStorage, bcrypt password hashing, and no tokens in URLs
- Provides HTTP security headers and a Flask reference covering role-based access, Google OAuth via Authlib, and hashed API keys
Install
$ npx -y skills add secondsky/claude-skills --skill api-authentication -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
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)
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' });
}
Details
- Repository
- github.com/secondsky/claude-skills
- Categories
- Backend & APIs, Security
- First seen
- Jun 3, 2026
Questions
What does the api-authentication skill do?
api-authentication teaches the agent to implement secure API authentication with JWT, OAuth 2.0 and API keys. It covers token generation and verification middleware, security headers, and common authentication mistakes to avoid.
Who should use the api-authentication skill?
api-authentication is for developers building authentication systems, third-party integrations, or service-to-service communication. It also helps when debugging token management, security header, or auth flow errors.
How do I install the api-authentication skill?
Run npx -y skills add secondsky/claude-skills --skill api-authentication -y in your project. After that, the api-authentication skill lets the agent follow its JWT, OAuth 2.0 and API key guidance when you work on authentication code.
Where does api-authentication sit in its category?
api-authentication is listed in the Backend & APIs category on Claude Marketplaces. Its own guidance covers JWT with HttpOnly cookies, bcrypt password hashing and rate limiting on auth endpoints, plus Flask and Google OAuth examples in a reference file.
More from secondsky/claude-skills
All 116- Progressive Web App562
- Code Review561
- Kpi Dashboard Design547
- Vulnerability Scanning547
- Bun Sqlite543
- Bun Sveltekit526
- Api Security Hardening525
- Tanstack Table525
- Architecture Patterns523
- Api Rate Limiting518
- Threejs518
- Design System Creation517
- React Composition Patterns505
- Api Contract Testing502
- React Native Skills501
- Technical Specification501
- Mobile App Testing492
- Ml Model Training489
- Csrf Protection488
- Bun Test Basics485
- Payment Gateway Integration484
- Test Quality Analysis481
- Bun Hono Integration477
- Api Reference Documentation476
Similar to Api Authentication
More Backend & APIssession-managementSkillsecondsky/claude-skills441 installsSecure session management guide covering JWT access and refresh tokens, Redis storage, and cookie hardening.
auth-implementation-patternsSkillwshobson/agents21.7K installsCatalog-style summary of authentication and authorization patterns covering JWT, OAuth2, sessions, and RBAC.
api-security-best-practicesSkilldavila7/claude-code-templates471 installsComprehensive guide for building secure REST, GraphQL, and WebSocket APIs with auth, validation, and rate limiting.
oauth-implementationSkillsecondsky/claude-skills432 installsOAuth 2.0 and OpenID Connect guide covering flow selection, Express code, and PKCE for public clients.
jwt-authenticationSkillpluginagentmarketplace/custom-plugin-nodejs227 installsNode.js JWT authentication with access and refresh tokens, plus role-based access control middleware.
backend-api-securityPluginHermeticOrmus/LibreUIUX-Claude-Code127 starsAPI security hardening, authentication implementation, authorization patterns, rate limiting, and input validation