OAuth 2.0 Grant Type Reference

All OAuth 2.0 flows with use case and token types.

Searchable reference of OAuth 2.0 grant types — authorization code, PKCE, client credentials, device code, refresh, implicit and password — with use case, tokens issued and OAuth 2.1 status.

Which OAuth grant should I use for a single-page app?

Authorization Code with PKCE. SPAs are public clients that cannot keep a secret, and PKCE binds the authorization code to the client that requested it, preventing interception. The older Implicit flow is deprecated and should not be used for new apps.

Pick the right OAuth 2.0 flow for your client

OAuth 2.0 defines several grant types — each a different way for a client to obtain an access token. The right one depends on whether a user is present, whether the client can keep a secret, and what kind of device runs it. This reference lists each grant with its grant_type value, intended use case, the tokens it issues and its current status under OAuth 2.1.

How it works

Most user-facing flows split into a front channel (the browser redirect where the user authenticates) and a back channel (a server-to-server token exchange). The Authorization Code flow returns a short-lived code on the front channel, which the client swaps for tokens on the back channel — so the token never travels through the URL. PKCE strengthens this by binding the code to the original requester.

1. App -> /authorize?response_type=code&code_challenge=...   (front channel)
2. User logs in, consents
3. AS  -> redirect_uri?code=AUTH_CODE
4. App -> /token  code=AUTH_CODE&code_verifier=...           (back channel)
5. AS  -> { access_token, refresh_token, id_token }

Machine-to-machine calls skip the user entirely with Client Credentials, and input-limited hardware uses the Device Authorization flow with polling.

Tips and notes

  • Default to Authorization Code with PKCE for any flow that signs in a user.
  • Use Client Credentials only for trusted backend services, never from a browser where the secret would leak.
  • Treat refresh tokens as sensitive: rotate them for public clients and detect reuse to limit damage from theft.
  • Do not build new integrations on Implicit or Password grants — both are removed in OAuth 2.1.