OAuth 2.0 is an authorization framework that lets an application get limited access to a user's data on another service through tokens, without ever handling the user's password. It is defined in RFC 6749 from October 2012, which replaced OAuth 1.0. Current security guidance is RFC 9700, published in January 2025 as BCP 240, and it updates RFC 6749.
RFC 6749 names four roles. The resource owner is usually the user. The client is the app that wants access. The authorization server authenticates the user and issues tokens. The resource server hosts the protected data and accepts access tokens.
The most common flow is the authorization code grant:
response_type=code, client_id, redirect_uri, scope and state.code and the same state.grant_type=authorization_code, and receives an access token, a token_type, expires_in and optionally a refresh token.Authorization: Bearer <token> to the resource server.The authorization endpoint and token endpoint must use TLS. A code must expire quickly, with a maximum lifetime of 10 minutes recommended, and may be used only once.
RFC 6749 defined four grant types: authorization code, implicit, resource owner password credentials and client credentials. RFC 9700 says the password grant must not be used and the implicit grant should not be used. OAuth 2.1 omits both grants, but as of October 2026 it is still an IETF draft, not an RFC.
A Python script built these two requests. The PKCE verifier and challenge are the RFC 7636 test vector, and the script confirmed the SHA-256 result matches.
https://auth.example.com/authorize?response_type=code&client_id=s6BhdRkqt3&redirect_uri=https%3A%2F%2Fapp.example.com%2Fcb&scope=read&state=xyz&code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM&code_challenge_method=S256
grant_type=authorization_code&code=SplxlOBeZQQYbYS6WxSbIA&redirect_uri=https%3A%2F%2Fapp.example.com%2Fcb&client_id=s6BhdRkqt3&code_verifier=dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
OAuth 2.0 is authorization: it answers what an app may do, not who the user is. RFC 6749 treats an access token as usually opaque to the client. Apps that need to sign users in use OpenID Connect, which is a simple identity layer on top of OAuth 2.0 and adds an ID token.
PKCE, Proof Key for Code Exchange, is an extension in RFC 7636, pronounced "pixy", that ties an authorization code to the client that requested it. The client makes a random code_verifier of 43 to 128 characters, sends its SHA-256 hash as code_challenge with method S256, and later proves possession by sending the verifier. RFC 9700 requires PKCE for public clients and recommends it for confidential ones.
state to the value stored for that browser session, an attacker can inject their own code. RFC 6749 requires CSRF protection and recommends the state parameter for it.