Authorization Code Flow
The Authorization Code Flow is a common way for an application to get permission to access resources on a user's behalf without ever handling the user's password. The user is sent to a trusted authorization server to approve access, and the application receives a short-lived code that it then exchanges for a token. This two-step exchange keeps the token out of the browser's address bar and makes the process more secure.
The Authorization Code Flow is an OAuth 2.0 grant type in which a client obtains delegated authorization to access protected resources. The resource owner (user) is redirected to the authorization server to grant consent, after which the authorization server returns an authorization code to the client's redirect URI; the client then exchanges that code at the token endpoint for tokens. Because the code-for-token exchange occurs on a back channel, this flow is typically recommended for confidential clients capable of securely storing a client secret. Public clients (for example single-page or native applications) commonly extend this flow with PKCE (Proof Key for Code Exchange) to mitigate authorization code interception, depending on configuration. Note that OAuth 2.0 governs delegated authorization rather than user authentication; when an ID token is required for authentication, this flow is used within OpenID Connect built on top of OAuth 2.0. The exact tokens returned and their handling vary by authorization server and profile.
Why it matters
The Authorization Code Flow is the most widely used OAuth 2.0 grant type, and it underpins a large portion of delegated-access scenarios that IAM teams design and operate. Its core value is that the application never handles the user's credentials directly: the user authenticates and grants consent at a trusted authorization server, and the application receives only a short-lived authorization code. This separation reduces the attack surface associated with credential handling and keeps tokens out of the browser's address bar, since the code-for-token exchange happens on a back channel rather than being exposed in a front-channel redirect.
For security architects and IAM engineers, choosing the right grant type is a foundational design decision that affects where secrets are stored, how tokens are protected in transit, and which client types can safely participate. The Authorization Code Flow is typically recommended for confidential clients that can securely store a client secret, while public clients such as single-page and native applications commonly extend it with PKCE to mitigate authorization code interception. Selecting an inappropriate flow, or omitting protections such as PKCE where they apply, can weaken an otherwise sound authorization architecture.
It is also important to keep the flow's scope clear: OAuth 2.0, including the Authorization Code Flow, governs delegated authorization rather than user authentication. When an application needs to authenticate the user and obtain an ID token, the flow is used within OpenID Connect, which is built on top of OAuth 2.0. Conflating the two leads to design and audit errors, so teams should be explicit about whether a given deployment is performing delegated authorization, authentication, or both.
Who it's relevant to
Inside Authorization Code Flow
Common questions
Answers to the questions practitioners most commonly ask about Authorization Code Flow.
