Does the implicit grant response return the state parameter the client sent?

state returned exactly in the implicit grant responseRFC 6749 §4.2.2REQUIREDRoles: authorization_server

Requirement as recorded in the ProtocolSoup registry

state REQUIRED if the "state" parameter was present in the client authorization request. The exact value received from the client.

Read §4.2.2 in RFC 6749

Self-test verdict

PassCommit 00bac3fEvaluated

This is ProtocolSoup's result against its own implementation at the commit shown. It is not a certification of ProtocolSoup or of any other product.

Captured from production

Captured Commit 00bac3f

Captured from the deployed ProtocolSoup at the commit shown. Every request and response is shown exactly as sent and received.

Passing exchange

Not captured: The response this requirement constrains is the authorization response, which answers the End-User's sign-in. A capture does not record the sign-in: how the resource owner authenticates is the authorization server's own business, not an OAuth 2.0 message.

Failing exchange

Not captured: The response this requirement constrains is the authorization response, which answers the End-User's sign-in. A capture does not record the sign-in: how the resource owner authenticates is the authorization server's own business, not an OAuth 2.0 message.

Run it live

Looking Glass runs the flow that sends the message this requirement governs, against the same server, and decodes each exchange as it happens.

Open the flow in Looking Glass

Tests

Implementation

Explainer

What this requires

Yes: the implicit grant response returns the state parameter the client sent. The grant returns its parameters in the fragment of the redirection URI, and state is one of them: present whenever the request carried it, with the exact value received.

Everything else about the parameter is as in the authorization code response. It is the client's value, and the server stores it and returns it without reading it. The difference is where it comes back. A fragment is not sent to the client's web server, so the code that reads state is script running in the page.

Why it exists

A client using the implicit grant accepts an access token from its own URL. Without a check, any page can navigate the browser to the client's redirect URI with a fragment containing a token of the attacker's choosing, and the client would start using it. RFC 6749 Section 10.12 describes the result of such an injection: "the client using an access token associated with the attacker's protected resources rather than the victim's". Comparing the returned state with the one stored before the redirect is how the script knows the response answers a request it made.

What non-compliance looks like

Returning state in the query while the token is in the fragment, so that single-page clients looking in the fragment never find it. Building the fragment by concatenation and breaking on a state that contains & or #. Leaving it out of the implicit path because that path was added later.

How ProtocolSoup tests it

This server builds the fragment with the same encoder it uses for a query string and appends it after #. TestAuthorizationResponseReturnsTheExactState runs an implicit grant as public-app with a state containing a space, +, &, =, /, %20, ?, #, a double quote, angle brackets and a non-ASCII letter. It parses the fragment of the redirect and requires an access_token and exactly one state equal to the original. TestImplicitGrantReturnsAccessTokenInFragment checks a plain state the same way and confirms nothing was placed in the query.

There is no captured exchange for this row. The fragment response answers the End-User's sign-in, and a capture does not record the sign-in.

Related requirements

All RFC 6749 requirements · OAuth 2.0 protocol page

Does the implicit grant response return the state parameter the client sent? · RFC 6749 §4.2.2 | ProtocolSoup