OAuth response modes: where codes and tokens reach the callback
OAuth `response_mode` tells an authorization server how to send authorization response parameters to the client's redirect URI. Common modes are URL query, fragment, and an auto-submitted HTML form using POST (`form_post`). The mode is not freely interchangeable for every `response_type`; standards set defaults and constraints. Review the token type and the callback's actual behavior together.
OAuth response modes: where codes and tokens reach the callback
OAuth response_mode tells an authorization server how to send authorization response parameters to the client's redirect URI. Common modes are URL query, fragment, and an auto-submitted HTML form using POST (form_post). The mode is not freely interchangeable for every response_type; standards set defaults and constraints. Review the token type and the callback's actual behavior together.
Common modes
| Mode | Where parameters arrive | Main consideration |
|---|---|---|
query | Query string of the callback URL | May appear in server logs, browser history, or Referer. Do not use it for token-containing response types. |
fragment | After # in the callback URL | The browser does not send the fragment in the HTTP request, but client scripts and browser history handle it. |
form_post | URL-encoded body of an auto-submitted HTTP POST | The callback must accept POST with application/x-www-form-urlencoded; review state/CSRF checks, SameSite cookies, logs, and instrumentation. |
For plain code, the default is query; for token, it is fragment. The multiple-valued combinations code token, code id_token, and code id_token token default to fragment, and query MUST NOT be used for them. Form Post Response Mode is a separate extension; confirm that the provider and client profile support it rather than assuming availability.
Choose and validate a mode
With a code-only response, confirm that the registered redirect callback handles query values safely and limit code exposure through logs and browser features.
Do not put an access token or ID Token in a query response. Prefer authorization code flow when possible to avoid front-channel token delivery.
`form_post` can keep values out of the URL, but does not verify the response. Check state, issuer, and code/ID Token as usual. Also verify cross-site POST cookie behavior, CSRF controls, and that request bodies are not copied into logs or analytics.
Reject unexpected methods, malformed values, and duplicate sensitive parameters according to the client library and policy. Never write raw codes or tokens to diagnostic logs.
Provider support and accepted combinations vary by deployment. Check the applicable OAuth/OIDC profile and authorization-server documentation; this article is not a product compatibility list.
Sources
[OAuth 2.0 Multiple Response Type Encoding Practices](https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html)
[OAuth 2.0 Form Post Response Mode](https://openid.net/specs/oauth-v2-form-post-response-mode-1_0.html)
[OpenID Connect Core 1.0](https://openid.net/specs/openid-connect-core-1_0.html)