Part 3: Authentication Protocols and Flows
The Day I Implemented the Wrong Flow
OAuth 2.0 and OpenID Connect: The Foundation
OAuth 2.0
OpenID Connect (OIDC)
OpenID Connect
β
βββββ Built on top of OAuth 2.0
β
βββββ Adds identity layerWhat You Get From Each
MS Entra Authentication Endpoints
v1.0 Endpoint (Legacy)
v2.0 Endpoint (Current)
Well-Known Configuration
OAuth 2.0 Flows in MS Entra
Flow Selection Matrix
1. Authorization Code Flow with PKCE
The Problem It Solves
How PKCE Works
Complete React SPA Example
The Flow Diagram
2. Authorization Code Flow (Without PKCE)
Node.js Express Example
3. Client Credentials Flow
When to Use
Implementation Example
Service-to-Service Communication
4. On-Behalf-Of (OBO) Flow
The Scenario
Implementation
OBO Token Claims
5. Resource Owner Password Credentials (ROPC)
6. Device Code Flow
How It Works
CLI Tool Example
SAML Integration
SAML vs OAuth 2.0
When MS Entra Uses SAML
SAML Configuration in MS Entra
Implementing SAML in Node.js
Flow Comparison Summary
Common Pitfalls
Pitfall 1: Using Implicit Flow
Pitfall 2: Wrong Scopes
Pitfall 3: Not Validating Tokens
Key Takeaways
What's Next
Last updated