Skip to content
StackPractices

Tag: authentication

Browse 35 practical software engineering resources tagged with "authentication". Discover code recipes, design patterns, documentation templates, and in-depth guides to help you build, deploy, and maintain production-ready solutions involving authentication.

Middleware

How to implement request/response middleware for logging, auth, and error handling across Python, JavaScript, and Java.

WebSocket Authentication and Security Patterns

How to authenticate WebSocket connections, implement token validation, and handle authorization for real-time messaging in production

Design a Scalable API Gateway for Microservices

How to build an API gateway that routes requests, handles authentication, rate limiting, caching, and protocol translation between clients and backend microservices.

Secure API Key Authentication for Services and Clients

How to generate, distribute, validate, and rotate API keys for machine-to-machine authentication using HMAC signatures, scopes, and rate-limited key policies.

Hash Passwords with Argon2

How to hash and verify passwords securely with Argon2id, the winner of the Password Hashing Competition, with correct parameter tuning and migration strategies from bcrypt.

Implement ABAC

How to implement attribute-based access control with policy engines, live context evaluation, and fine-grained authorization decisions across Python, Node.js, and Java.

Implement RBAC

How to implement role-based access control with hierarchical roles, permission grants, and middleware enforcement across Python, Node.js, and Java.

Implement SSO with SAML

How to implement SAML 2.0 single sign-on as a Service Provider with XML signature verification, IdP metadata handling, and secure session management in Python, Node.js, and Java.

JWT Authentication

How to generate, validate, and refresh JSON Web Tokens for stateless API authentication.

Implement Passwordless Login with Magic Links

How to build secure passwordless authentication using time-limited magic links sent via email, with token generation, validation, and replay attack prevention.

Node.js JWT Authentication: Verify and Refresh Tokens

Implement JWT authentication in Node.js with access and refresh tokens

Node.js OAuth2 GitHub Login with Express

Implement GitHub OAuth2 login flow in Node.js with Express and Passport

OAuth 2.0 Login

How to implement OAuth 2.0 authentication with Google, GitHub, and other providers.

Password Hashing

How to securely hash and verify passwords using modern algorithms across Python, JavaScript, and Java.

Implement Secure Session Management

How to create, validate, and expire user sessions securely across web applications using cookies, tokens, and server-side storage.

Two-Factor Authentication (2FA / TOTP)

How to implement time-based one-time password (TOTP) two-factor authentication for secure user login.

Field-Level Auth with Custom GraphQL Schema Directives

Implement field-level authorization in GraphQL using custom schema directives that check user roles and permissions per field

SSH Key Management in Bash

Generate, rotate, and distribute SSH keys with bash scripts

Protect Web Forms Against CSRF Attacks

How to prevent Cross-Site Request Forgery attacks using synchronizer tokens, SameSite cookies, and double-submit cookie patterns.

HMAC Request Signing

Secure API requests with HMAC-SHA256 signatures to ensure integrity and authenticity.

Implement OAuth 2.0 PKCE for Single-Page Applications

How to implement the OAuth 2.0 PKCE flow in single-page applications to securely authenticate users without exposing client secrets

Password Hashing in Production

Securely hash and verify passwords using bcrypt, scrypt, and Argon2 with what works.

Secure JWT Refresh Token Rotation with Python

Implement secure JWT access and refresh token rotation in Python with blacklist, reuse detection, and automatic access token renewal for stateless auth

Secure API Gateway with Custom Lambda Authorizers

Implement custom Lambda authorizers for API Gateway with JWT validation, IAM policy generation, and caching for token-based authentication in serverless APIs.

Federated Identity Pattern

Delegate authentication to external identity providers. A pattern for integrating OAuth2, OIDC, SAML, and SSO across multiple services and organizations.

Access Control Policy Template

A template for defining authentication, authorization, RBAC, ABAC, MFA, password policies, session management, and access review procedures.

API Authentication Design Template

Template for documenting API authentication flows and token lifecycle: auth scheme selection, token types, issuance, validation, refresh, revocation, MFA, OAuth2 flows, JWT configuration, and security best practices with code examples.

API Security Review Template

A checklist template for reviewing API authentication, rate limiting, and OWASP compliance.

Complete Guide to GraphQL Security

Secure GraphQL APIs against introspection leaks, query depth attacks, cost-based DoS, batching abuse, and injection. Covers auth patterns, rate limiting, and production hardening.

API Gateway: Routing, Auth, Rate Limiting

Master API gateway architecture: request routing, authentication, rate limiting, request shaping, response caching, protocol translation, and production deployment patterns.

API Security Checklist — Authentication to Encryption

A thorough security checklist for APIs: authentication, authorization, input validation, rate limiting, encryption, logging, and deployment hardening.

Complete Guide to Authentication Patterns

Implement authentication in production. Covers JWT, OAuth2, session-based auth, passkeys, MFA, refresh tokens, token rotation, RBAC, ABAC, SSO with SAML and OpenID Connect, and secure logout patterns with practical code examples.

OAuth2 and OIDC: Authorization Code, PKCE, Token Validation

Master OAuth2 and OpenID Connect for production: authorization code flow with PKCE, token validation, refresh tokens, scopes, JWT verification, and security best practices.

Secure Coding Practices — By Language and Pattern

A practical guide to secure coding practices across languages: input validation, memory safety, authentication, and defensive patterns for Python, Java, JavaScript, and Go.

Security Best Practices Guide

A thorough guide to application security: authentication, authorization, input validation, secrets management, and common vulnerability prevention.