aj-geddes avatar

Oauth Implementation

This walks you through implementing OAuth 2.0, OpenID Connect, and JWT authentication from scratch. You get complete server implementations in Node.js, Python, and Java Spring Security, covering authorization code flows, token management, and PKCE for mobile clients. The quick start drops you into a functional Express OAuth server with all the core components. Best practices are solid and opinionated: use PKCE, rotate tokens, never touch implicit flow, keep access tokens short-lived. If you're building authentication for a new app or integrating SSO across microservices, this gives you the security patterns without having to piece together blog posts and RFCs.

skills.sh installs
558
GitHub stars
379
last updated
Aug 21, 2026

Install

$ npx -y skills add aj-geddes/useful-ai-prompts --skill oauth-implementation --agent claude-code

Installs into .claude/skills of the current project.

Files

OAuth Implementation

Table of Contents

Overview

Implement industry-standard OAuth 2.0 and OpenID Connect authentication flows with JWT tokens, refresh tokens, and secure session management.

When to Use

  • User authentication systems
  • Third-party API integration
  • Single Sign-On (SSO) implementation
  • Mobile app authentication
  • Microservices security
  • Social login integration

Quick Start

Minimal working example:

// oauth-server.js - Complete OAuth 2.0 implementation
const express = require("express");
const jwt = require("jsonwebtoken");
const crypto = require("crypto");
const bcrypt = require("bcrypt");

class OAuthServer {
  constructor() {
    this.app = express();
    this.clients = new Map();
    this.authorizationCodes = new Map();
    this.refreshTokens = new Map();
    this.accessTokens = new Map();

    // JWT signing keys
    this.privateKey = process.env.JWT_PRIVATE_KEY;
    this.publicKey = process.env.JWT_PUBLIC_KEY;

    this.setupRoutes();
  }

Sponsors

Details

Repository
github.com/aj-geddes/useful-ai-prompts
Categories
Backend & APIs, Security, AI & Agent Building, Mobile Development
First seen
Jun 3, 2026

More from aj-geddes/useful-ai-prompts

All 258
1libukai avatarvscode-sftp-configlibukai/awesome-agent-skillsThis skill should be used when setting up SFTP deployment for static websites to production servers, including converting projects from Docker/Express to static557skills.sh installs
2auth0 avatarauth0-fastifyauth0/agent-skillsUse when adding session-based login, logout, or protected routes to a Fastify web application. Integrates @auth0/auth0-fastify — use even if the user says "add 555skills.sh installs
3andreadellacorte avatargroove-utilities-task-doctorandreadellacorte/grooveCheck task backend health and connectivity.551skills.sh installs
4aj-geddes avatarreal-time-featuresaj-geddes/useful-ai-promptsImplement real-time functionality using WebSockets, Server-Sent Events (SSE), or long polling. Use when building chat applications, live dashboards, collaborati548skills.sh installs
5inertia-rails avatarinertia-rails-architectureinertia-rails/skillsServer-driven architecture patterns for Inertia Rails + React. Load this FIRST when building any Inertia page or feature — it routes to the right skill. Decisio545skills.sh installs
6odysseus0 avatarlinearodysseus0/symphonyLinear GraphQL patterns for Symphony agents. Use `linear_graphql` for all operations — comments, state transitions, PR attachments, file uploads, and issue crea542skills.sh installs