Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
aj-geddes avatar

Api Authentication

  • 519 installs
  • 305 repo stars
  • Updated March 4, 2026
  • aj-geddes/useful-ai-prompts

api-authentication is an agent skill that generates production-ready API authentication code using JWT, OAuth 2.0, API keys, and session management for developers securing endpoints and login flows.

About

api-authentication is a skill in aj-geddes/useful-ai-prompts that implements secure API authentication patterns with JWT tokens, OAuth 2.0 providers, API keys, and session management following documented best practices. A Node.js quick-start shows express login with bcrypt password verification, signed access tokens, and separate refresh secrets loaded from environment variables. Four reference guides ship in references/: jwt-authentication, oauth-20-implementation, api-key-authentication, and python-authentication-implementation for language-specific depth. Developers reach for this skill when securing endpoints, building login and logout flows, managing refresh tokens, or integrating third-party OAuth providers. The skill emphasizes HTTPS-only transport and proper secret handling rather than demo-hardcoded keys in production paths.

  • Generates complete JWT token implementation with login, refresh, and logout flows
  • Produces OAuth 2.0 provider integration patterns for Google, GitHub and similar services
  • Creates secure API key validation middleware and usage tracking
  • Includes session management with proper cookie security and revocation
  • Delivers best-practice token storage, rotation, and revocation strategies

Api Authentication by the numbers

  • 519 all-time installs (skills.sh)
  • Ranked #803 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill api-authentication

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs519
repo stars305
Last updatedMarch 4, 2026
Repositoryaj-geddes/useful-ai-prompts

How do you implement JWT and OAuth API authentication?

Generate secure, production-ready authentication code for APIs using JWT, OAuth 2.0, API keys, and session management.

Who is it for?

Backend developers adding JWT, OAuth 2.0, API key, or session auth to REST or Express APIs who want reference-guided secure implementations.

Skip if: Developers who only need frontend UI mockups without server-side token or session logic.

When should I use this skill?

The user asks to secure API endpoints, implement login flows, manage JWT or refresh tokens, or integrate OAuth 2.0 providers.

What you get

Authentication route handlers, token issuance logic, OAuth integration code, and API key middleware with reference guide implementations.

  • auth route handlers
  • token and session middleware

By the numbers

  • Documents 4 authentication strategies: JWT, OAuth 2.0, API keys, and sessions
  • Includes 4 reference guides under references/ for language-specific implementations

Files

SKILL.mdMarkdownGitHub ↗

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;

    // Find user in database
    const user = await User.findOne({ email });
    if (!user) {
      return res.status(401).json({ error: 'Invalid credentials' });
    }

    // Verify password
    const isValid = await bcrypt.compare(password, user.password);
    if (!isValid) {
      return res.status(401).json({ error: 'Invalid credentials' });
    }
// ... (see reference guides for full implementation)

Reference Guides

Detailed implementations in the references/ directory:

GuideContents
JWT AuthenticationJWT Authentication
OAuth 2.0 ImplementationOAuth 2.0 Implementation
API Key AuthenticationAPI Key Authentication
Python Authentication ImplementationPython Authentication Implementation

Best Practices

✅ DO

  • Use HTTPS for all authentication
  • Store tokens securely (HttpOnly cookies)
  • Implement token refresh mechanism
  • Set appropriate token expiration times
  • Hash and salt passwords
  • Use strong secret keys
  • Validate tokens on every request
  • Implement rate limiting on auth endpoints
  • Log authentication attempts
  • Rotate secrets regularly

❌ DON'T

  • Store passwords in plain text
  • Send tokens in URL parameters
  • Use weak secret keys
  • Store sensitive data in JWT payload
  • Ignore token expiration
  • Disable HTTPS in production
  • Log sensitive tokens
  • Reuse API keys across services
  • Store credentials in code

Related skills

How it compares

Use api-authentication instead of generic security prompts when you need reference-backed JWT, OAuth, API key, and session patterns for APIs.

FAQ

Which authentication methods does api-authentication cover?

api-authentication covers JWT tokens, OAuth 2.0, API keys, and session management for APIs. It includes Node.js quick-start code plus four reference guides for JWT, OAuth, API keys, and Python implementations.

Where are detailed implementations documented?

api-authentication stores detailed patterns in references/jwt-authentication.md, references/oauth-20-implementation.md, references/api-key-authentication.md, and references/python-authentication-implementation.md alongside the main SKILL.md quick start.

Backend & APIsbackendintegrations

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.