GRC Careers

HomeResourcesOAuth 2.0

CS-068 · API Security

OAuth 2.0

A delegated authorization framework that lets apps access resources without handling user passwords.

Executive Summary

OAuth 2.0 is a framework for delegated authorization: it lets an application access a limited part of a user's resources on another service without ever seeing that user's password. Instead of sharing credentials, the user grants consent and the application receives a scoped, short-lived access token. Secure OAuth depends on using the right flow, limiting scopes, protecting tokens, and validating redirects.

What It Is

OAuth 2.0 is an authorization framework, not a login system by itself. It solves a specific problem: how can one application act on a user's behalf at another service without the user handing over their password. The user authorizes the application, an authorization server issues an access token that represents that grant, and the application presents the token to a resource server to access only what was permitted. The key pieces are the resource owner (the user), the client (the application requesting access), the authorization server (which authenticates the user and issues tokens), and the resource server (which holds the data). Access is limited by scopes, which describe exactly what the token may do. Because OAuth handles authorization rather than proving identity, an identity layer such as OpenID Connect is built on top of it when login is the goal.

Why It Matters

OAuth 2.0 is the backbone of connecting apps together and of most sign-in-with providers, so it governs access to enormous amounts of personal and business data. Done well, it removes the dangerous practice of sharing passwords across services and limits each application to the narrow access it needs. Done poorly, it opens serious holes: a mishandled redirect can hand tokens to an attacker, an over-broad scope can grant far more access than intended, and a leaked token can be replayed. For engineers and security professionals, understanding OAuth flows and their failure modes is essential because the framework is flexible, and much of its security comes from choosing and configuring the right flow rather than from the framework enforcing safety automatically.

How It Works

The recommended pattern is the authorization code flow. The client redirects the user to the authorization server, where the user authenticates and consents to specific scopes. The authorization server sends the user back to the client with a short-lived authorization code. The client then exchanges that code, over a back channel, for an access token and often a refresh token. The access token is presented to the resource server on each request and grants only the permissions in its scopes. For public clients such as mobile and single-page apps, a protection called PKCE binds the code exchange to the client that started it, preventing an intercepted code from being redeemed by an attacker. Access tokens should be short-lived; refresh tokens let the client obtain new access tokens without asking the user to sign in again, and they must be stored and rotated carefully.

Architecture Diagram

User is redirected to the authorization serverUser authenticates and consents to scopesAuthorization server returns a short-lived codeClient exchanges the code for tokens over the back channelClient uses the access token at the resource server
In the authorization code flow the user consents, the client receives a code, and the code is exchanged for a scoped access token.

Visual Workflow

Register the client and its exact redirect URIs with the authorization server.Use the authorization code flow, and add PKCE for public clients such as mobile and single-page apps.Request only the scopes the application actually needs.Exchange the authorization code for tokens over a secure back channel.Present short-lived access tokens to the resource server and refresh them as needed.Store refresh tokens securely, rotate them, and revoke access when it is no longer needed.

Common Attacks

Common Mistakes

Best Practices

Quick Checklist

Recommended Tools

Authorization server
Authenticates users, obtains consent, and issues scoped tokens
Identity provider
Hosts OAuth and often OpenID Connect for delegated access and login
OAuth client library
Implements the flows and PKCE correctly in application code
API gateway
Validates access tokens and enforces scopes in front of resource servers

Industry Standards

OAuth 2.0 Authorization Framework (RFC 6749)
Defines the core roles, flows, and tokens
Proof Key for Code Exchange (PKCE, RFC 7636)
Protects the authorization code exchange for public clients
OAuth 2.0 Security Best Current Practice
Current IETF guidance on securing OAuth deployments

Career Relevance

OAuth 2.0 is essential knowledge for backend engineers, application security engineers, and API security engineers who build and secure integrations and sign-in features. Security engineers and penetration testers test OAuth flows for redirect and token flaws, and identity and AI governance professionals rely on OAuth concepts because it governs how applications and AI agents obtain delegated access to protected resources.

Interview Questions

Related Certifications

OWASP-aligned application security training GIAC Web Application Penetration Tester (GWAPT) Identity and access management vendor certifications (vendor-neutral concepts)

Further Reading

Key Takeaways

Download PDFDownload PNG

FAQ

Is OAuth 2.0 a login system?

Not by itself. OAuth handles authorization, meaning delegated access to resources. To authenticate a user and confirm who they are, you use OpenID Connect, which is an identity layer built on top of OAuth 2.0.

Why is PKCE recommended even for confidential clients?

PKCE binds the authorization code to the client that started the flow, which prevents an intercepted code from being redeemed by an attacker. Current best practice recommends it broadly, not only for public clients, because it strengthens the code exchange with little cost.

What is the difference between an access token and a refresh token?

An access token is short-lived and presented to the resource server to make requests. A refresh token is longer-lived and used only to obtain new access tokens without asking the user to sign in again. Refresh tokens must be stored securely and rotated.

Get all 116 reference sheets
The complete AGJ Cybersecurity Professional Reference Library, print-ready PDFs and PNGs.
Browse the library

Related Careers

Related certifications

OWASP-aligned application security trainingGIAC Web Application Penetration Tester (GWAPT)Identity and access management vendor certifications (vendor-neutral concepts)

Current openings

Live openings appear on the web version. Browse the job board for current GRC and security roles.
Browse all jobs

Suggested learning path

  1. Ground the basics with CS-001 Cybersecurity
  2. Study this sheet: OAuth 2.0
  3. Go deeper: OpenID Connect
  4. Go deeper: JSON Web Tokens (JWT)
  5. Validate it: work toward OWASP-aligned application security training
  6. Find the role: browse current openings

Related sheets

More in API Security

Share this LinkedIn Facebook X Email