OAuth 2.0, OIDC, and SAML
Authentication and authorization protocols like OAuth 2.0, OpenID Connect (OIDC), and SAML are foundational to modern identity systems.
Interviewers expect you to understand how these protocols work conceptually, what problems they solve, and how they fit into IAM design. This lesson gives you a clear, structured way to explain them without overwhelming detail.
Strong candidates show that they can:
- Describe how federated identity systems authenticate users.
- Differentiate between authentication and authorization flows.
- Recognize where each protocol is typically used.
- Identify common implementation risks.
What to expect
Typical interview prompts include:
- “Explain the difference between OAuth 2.0 and OIDC.”
- “How would you secure OAuth tokens in a web application?”
Overview
In interviews, reference their differences by focus:
- OAuth: Access control.
- OIDC: Authentication.
- SAML: Enterprise SSO and federation.
We will elaborate on what you need to know about each protocol for your interviews in the sections below.
OAuth 2.0
Purpose: Allow one application to access resources on behalf of a user without sharing credentials.
How it works:
- The user grants an application permission to access a resource (for example, Google Drive or GitHub).
- The app receives an access token from an authorization server.
- The token allows limited API access, scoped to the granted permissions.
Common pitfalls:
- Misconfigured redirect URIs leading to token leakage.
- Storing tokens insecurely.
- Missing scopes or token expiry controls.
OpenID Connect (OIDC)
Purpose: OIDC extends OAuth 2.0 to provide authentication in addition to authorization.
How it works:
- Uses OAuth 2.0 flows but adds an ID token that includes verified user identity information.
- Applications can use the ID token to authenticate the user.
Common pitfalls:
- Misinterpreting access tokens as identity proof.
- Failing to validate the ID token signature or issuer.
- Ignoring token expiration or audience claims.
SAML
Purpose: Provide federated single sign-on (SSO) between identity providers (IdPs) and service providers (SPs).
How it works:
- The user requests access to a service provider.
- The IdP authenticates the user and sends a SAML assertion (XML-based token).
- The service provider grants access based on the assertion.
Common pitfalls:
- XML signature wrapping attacks.
- Unvalidated assertions or issuers.
- Poor clock synchronization causing token reuse.