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. Each resource is written for engineers who ship real systems, with copy-paste examples and practical trade-offs.

Authentication and Identity

Authentication is the process of verifying who a user is before they access protected resources. Modern systems use tokens, sessions, OAuth, OIDC, and multi-factor authentication, each with different trade-offs.

The recipes below cover JWT, refresh tokens, OAuth2 with PKCE, password hashing, session management, and API key patterns. Each resource explains how to implement identity correctly and securely in production code.

Every resource includes clear explanations, copy-paste code, and practical warnings. Use them to make informed decisions, avoid production pitfalls, and speed up your delivery. If you are just getting started, read the beginner-friendly articles first; if you are experienced, jump straight to the advanced patterns and architecture guides. New resources are added regularly, so bookmark this page and check back for the latest patterns.

Middleware

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

WebSocket Authentication and Security Patterns

How to authenticate WebSocket connections, implement token validation, and handle authorization for...

Design a Scalable API Gateway for Microservices

Build an API gateway that routes requests, handles authentication, rate limiting, caching, and...

Secure API Key Authentication for Services and Clients

How to generate, distribute, validate, and rotate API keys for machine-to-machine authentication...

Hash Passwords with Argon2

How to hash and verify passwords securely with Argon2id, the winner of the Password Hashing...

Implement ABAC

How to implement attribute-based access control with policy engines, live context evaluation, and...

Implement RBAC

How to implement role-based access control with hierarchical roles, permission grants, and...

Implement SSO with SAML

How to implement SAML 2.0 single sign-on as a Service Provider with XML signature verification, IdP...

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...

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.

How to Hash Passwords Securely (Python, JavaScript, Java)

Learn how to hash and verify passwords with bcrypt, Argon2, and PBKDF2. Practical examples in...

Implement Secure Session Management

How to create, validate, and expire user sessions securely across web applications using cookies,...

Two-Factor Authentication (2FA / TOTP)

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

Field-Level Auth with Custom GraphQL Directives

Add field-level authorization to GraphQL with custom schema directives. Check roles, permissions,...

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...

HMAC Request Signing

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