
Api Authentication
This covers the core authentication patterns you'll actually use: JWT tokens, OAuth 2.0, API keys, and session management. The references include working implementations in both Node.js and Python, with examples for login flows, token refresh, and middleware protection. It's opinionated about security basics like HttpOnly cookies, bcrypt for passwords, and HTTPS everywhere. The best practices section is genuinely helpful, calling out common mistakes like storing tokens in URLs or logging credentials. If you're building an API and need to lock it down properly, this gives you the patterns and code to start from rather than piecing together blog posts.
- skills.sh installs
- 612
- GitHub stars
- 379
- last updated
- Aug 21, 2026
Install
$ npx -y skills add aj-geddes/useful-ai-prompts --skill api-authentication --agent claude-codeInstalls into .claude/skills of the current project.
Files
API Authentication
Table of Contents
Overview
Implement comprehensive authentication strategies for APIs including JWT tokens, OAuth 2.0, API keys, and session management with proper security practices.
When to Use
- Securing API endpoints
- Implementing user login/logout flows
- Managing access tokens and refresh tokens
- Integrating OAuth 2.0 providers
- Protecting sensitive data
- Implementing API key authentication
Quick Start
Minimal working example:
// Node.js JWT Implementation
const express = require('express');
const jwt = require('jsonwebtoken');
const bcrypt = require('bcrypt');
const app = express();
const SECRET_KEY = process.env.JWT_SECRET || 'your-secret-key';
const REFRESH_SECRET = process.env.REFRESH_SECRET || 'your-refresh-secret';
// User login endpoint
app.post('/api/auth/login', async (req, res) => {
try {
const { email, password } = req.body;
Sponsors
Details
- Repository
- github.com/aj-geddes/useful-ai-prompts
- Categories
- Backend & APIs, Security, AI & Agent Building
- First seen
- Jun 3, 2026
More from aj-geddes/useful-ai-prompts
All 258- Performance Testing609
- Competitor Analysis608
- Refactor Legacy Code608
- Security Testing607
- Frontend Accessibility604
- Design Patterns Implementation600
- Database Schema Design597
- Aws S3 Management595
- Database Query Optimization593
- Memory Leak Detection589
- Database Backup Restore588
- Technical Roadmap Planning582
- Accessibility Testing580
- Push Notification Setup580
- Database Schema Documentation576
- App Store Deployment569
- Mobile App Debugging568
- Security Audit Logging568
- Bundle Size Optimization567
- Process Mapping563
- Oauth Implementation558
- Integration Testing557
- Memory Optimization552
- Semantic Versioning552