OOmnistu

Blog / Security

Security

OAuth 2.0 explained: roles, tokens, and which grant to use

OAuth 2.0 lets an app act on a user's behalf with limited, scoped access - the four roles, access and refresh tokens, and what current best practice says about the grants.

OOmnistu
Reviewed 2026-11-20 · 4 min read

OAuth 2.0 is an authorization framework: per RFC 6749, it enables a third-party application to obtain limited access to an HTTP service, either on behalf of a resource owner by orchestrating an approval interaction between the resource owner and the service, or by allowing the application to obtain access on its own behalf. Published in October 2012, it obsoletes the OAuth 1.0 protocol. This guide covers the four roles, the tokens, and which grant the current best-practice document says to use.

The four roles

OAuth defines four roles. The resource owner is an entity capable of granting access to a protected resource - when it is a person, the spec calls it the end-user. The resource server hosts the protected resources and answers requests that carry access tokens. The client is the application making protected resource requests on behalf of the resource owner and with its authorization; the term implies nothing about where the application runs. And the authorization server issues access tokens to the client after successfully authenticating the resource owner and obtaining authorization. The authorization server may be the same server as the resource server or a separate entity.

Access tokens and refresh tokens

An access token is a string representing an authorization issued to the client. The string is usually opaque to the client, and tokens represent specific scopes and durations of access, granted by the resource owner and enforced by the resource server and authorization server. The token acts as an abstraction layer: it replaces constructs like a username and password with a single token the resource server understands. A refresh token is issued optionally, at the discretion of the authorization server, and is used to obtain a new access token when the current one expires.

The grants, and which one to use

The base specification defines four grant types: authorization code, implicit, resource owner password credentials, and client credentials. The authorization code grant routes the user through the authorization server, which returns a short-lived code the client then exchanges for tokens. Since 2012, practice has narrowed: RFC 9700, the current Best Current Practice document for OAuth 2.0 security, says clients SHOULD NOT use the implicit grant and instead use the authorization code grant, and that the resource owner password credentials grant MUST NOT be used because it exposes the user's credentials to the client. It also requires that public clients MUST use PKCE - Proof Key for Code Exchange - and that authorization servers MUST support it.

Authorization, not authentication

OAuth 2.0 answers "what may this app access", not "who is this user". When a product needs sign-in, the identity piece comes from a layer on top: OpenID Connect 1.0 describes itself as a simple identity layer on top of the OAuth 2.0 protocol, enabling clients to verify the identity of the end-user based on authentication performed by the authorization server.

The calm version

OAuth 2.0 lets an app act on a user's behalf with limited, scoped access, without handing over the user's password. Learn the four roles, use the authorization code grant with PKCE, and reach for OpenID Connect when you also need to know who the user is.

Sources: RFC 6749, The OAuth 2.0 Authorization Framework (IETF, October 2012; rfc-editor.org/rfc/rfc6749, fetched 2026-11-20): the framework definition, four roles, access and refresh tokens, and the four grant types. RFC 9700, Best Current Practice for OAuth 2.0 Security (IETF, 2025; rfc-editor.org/rfc/rfc9700, fetched 2026-11-20): implicit grant SHOULD NOT be used, resource owner password credentials grant MUST NOT be used, public clients MUST use PKCE. OpenID Connect Core 1.0 (openid.net/specs/openid-connect-core-1_0.html, fetched 2026-11-20): a simple identity layer on top of OAuth 2.0.

Frequently asked questions

What is OAuth 2.0?

An authorization framework, defined in RFC 6749, that lets a third-party application obtain limited access to an HTTP service - on behalf of a resource owner, or on its own behalf.

Is OAuth 2.0 the same as signing in?

No. OAuth 2.0 handles authorization - what an app may access. Verifying who the user is comes from OpenID Connect, a simple identity layer built on top of OAuth 2.0.

Which OAuth grant should a new application use?

The authorization code grant. The current Best Current Practice (RFC 9700) says clients SHOULD NOT use the implicit grant, the resource owner password credentials grant MUST NOT be used, and public clients MUST use PKCE.

What is an access token?

Per RFC 6749, a string representing an authorization issued to the client - usually opaque to the client - that represents specific scopes and durations of access, enforced by the resource server and authorization server.