Skip to main content
MediumAPIOWASP A07:2021CWE-522

How to fix: OAuth implicit grant (response_type=token) in use

A request made to an OAuth/OIDC authorize endpoint during the scan uses response_type=token (with no code value present), the deprecated implicit grant that returns the access token directly in the redirect URL fragment instead of through a back-channel exchange.

Why it matters

The implicit grant returns the access token in the fragment of a browser redirect, where it can leak via browser history, via the Referer header on any subsequent same-tab navigation that doesn't strip fragments, and to any script or browser extension with access to the page. It also gives the client no way to authenticate itself during the exchange, unlike the code flow's token endpoint call.

This inspects the actual request URL fetched during the scan for the OAuth authorize endpoint shape and a response_type value that includes token without also including code (a pure implicit or token-only hybrid request); a code+token hybrid request still uses an authorization code for the code portion and is left to the separate PKCE check.

How to fix it

  1. 1Migrate to the authorization code flow with PKCE; the implicit grant is removed entirely from OAuth 2.1 and disallowed by RFC 9700 for every client type
  2. 2For single-page apps, use a PKCE-enabled code flow with the token exchange happening in JavaScript, not response_type=token

Code examples

Migrate implicit grant to code + PKCE

JavaScript
// Before (implicit grant, deprecated):
// url.searchParams.set('response_type', 'token');

// After (authorization code + PKCE):
url.searchParams.set('response_type', 'code');
url.searchParams.set('code_challenge', challenge);
url.searchParams.set('code_challenge_method', 'S256');
// Exchange the returned code for tokens server-side or via a
// confidential token-exchange call, never in the URL fragment.

References

Detected automatically by VulnRadar. The check id is api-oauth-implicit-flow-response-type-token, stable across every scan so you can filter or diff on it.

See every api check

Questions

How severe is OAuth implicit grant (response_type=token) in use?
VulnRadar rates this medium severity in the api category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
Does VulnRadar check for this automatically?
Yes. It runs as part of every scan under the check id api-oauth-implicit-flow-response-type-token, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does OAuth implicit grant (response_type=token) in use map to?
It maps to CWE-522. In the OWASP Top 10 it falls under A07:2021.

Missing a check?

The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.

Propose a checkHow a check is built

Scan your own site for oauth implicit grant (response_type=token) in use

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

OAuth implicit grant (response_type=token) in use | VulnRadar