Beta

Create a tenant

A new tenant starts with its own users, OAuth settings, audit history and logs. You are its first Tenant Admin.

BTL Admin

OPENID CONNECT · LAB

Deliver one sign-in by query, fragment and form post

Turn on every response type and mode, send the same code-flow sign-in back by query, fragment and form post, and see exactly what reaches your server each time and what the tenant refuses.

ReadyUses your lab tenant

The lesson

Builds on: Implementing a relying party.

New to the labs? Start with the lab toolkit and the shared cast and names every lab uses.

Your progress

Press Start before you begin. Only events your tenant records after that count, in the order below. Checking reads your tenant's Audit, so you need Audit read access in it.

  1. Allow every response type and mode in Flow policy

    Recorded as tenant.oauth.policy.update succeeded.

  2. Allow them on lab-collage

    Recorded as tenant.oauth.clients.update succeeded.

  3. Receive a code by query, fragment or form post

    Recorded as oauth.authorize succeeded (code_issued) for lab-collage about [email protected].

  4. Receive a code and an ID token together

    Recorded as oauth.authorize succeeded (tokens_issued) for lab-collage about [email protected].

  5. See tokens refused in the query string

    Recorded as oauth.authorize rejected (unsupported_response_mode) for lab-collage.

  6. See a token-bearing request without a nonce refused

    Recorded as oauth.authorize rejected (invalid_nonce) for lab-collage.

Request console

Requests in this lab can be sent from this page to your tenant: open one and choose Send. Fill in the values below first. They stay in this page's memory and are gone when you leave; secrets are never stored or sent anywhere except the request you send.

Setup

All six response types and all three modes are real once the tenant's Flow policy and the client allow them.

  1. Press Start. In Lab Photos, open OAuth > Flow policy and note the current values. Allow the implicit grant, the response types code, id_token, id_token token, code id_token, code token and code id_token token, and the modes query, fragment and form_post.

  2. Open OAuth > Clients > lab-collage and allow the same grant, types and modes. Changing what a client may do revokes its existing tokens and remembered consent; that is expected.

Restore: these legacy types stay on only for this lab and the next one, which removes them. If you stop after this lab, restore the values you noted.

  1. source ~/btl-oidc.sh and run btl-lab callback before each request. The listener prints what reaches it, including the fields of a form post.

Walkthrough

  1. Metadata follows the policy.

GET$ISSUER/.well-known/openid-configuration Open in console
GET $ISSUER/.well-known/openid-configuration

response_types_supported lists all six types and response_modes_supported all three modes.

Why it matters: a relying party reads what the provider does today, and the tenant lists a type only when its grants and a suitable mode are allowed.

  1. Query, the default for code:

signin

The listener prints code, state and iss from the query string.

Why it matters: the server reads the response directly, and a short-lived, single-use, PKCE-bound code tolerates the URL's exposure.

  1. Fragment:

signin response_mode=fragment

The listener receives a request for /callback with no parameters at all. The address bar shows #code=...&state=...&iss=....

Why it matters: browsers never send the fragment to the server, so only a script on the callback page could read it.

  1. Form post:

signin response_mode=form_post

The tenant answers 200 with a page that submits itself; check its Cache-Control in the developer tools. The listener prints a POST with code, state and iss in the body, and the address bar and history show no code.

Why it matters: the response travels in a request body, out of URLs, logs and Referer headers.

  1. Default modes and word order:

RT="code id_token" signin
RT="id_token code" signin

With no response_mode, both land in the fragment, with a code and an ID token.

Why it matters: token-bearing types default to the fragment, and response type words are a set, compared without regard to order.

  1. Note what form post means for your own cookies. If your relying party kept its pending attempt in a cookie, that cookie would need SameSite=None; Secure, because the POST starts on the tenant's site, and the callback would be exempt from your framework's anti-forgery token because state, the nonce and PKCE already bind it.

Why it matters: a Lax attempt cookie does not travel with a cross-site POST, which is one of the most common causes of "no pending sign-in" after switching to form post.

Break it

  1. Tokens in a URL query:

RT="id_token token" signin response_mode=query

error=invalid_request, with a description saying responses that carry tokens cannot use the query mode.

  1. A mode the client lacks. Remove fragment from lab-collage and repeat walkthrough step 3: error=invalid_request, with a description naming the client. Remove it from Flow policy too, and the description names the tenant instead.

Restore: add fragment back to both, or leave it off if you will not need it in the next lab.

  1. A token-bearing type without a nonce:

URL=$(RT="code id_token" signin); echo "${URL/&nonce=$NONCE/}"

Open the printed URL: error=invalid_request, saying a nonce is required when the response includes an ID token.

Check your work

Press Check my progress. The checks look for the Flow policy and client changes, a code delivered to your callback, a hybrid response with a code and an ID token, and the refusals of query-mode tokens and a missing nonce.

In Audit, each successful request shows code_issued for a code alone and tokens_issued when the authorization endpoint also returned a token.

Cleanup

Keep the types and modes for Verify at_hash and c_hash, then migrate to code, which restores them. If you stop here, restore Flow policy and lab-collage to the values you noted.

Back to all labs

We value your privacy

We use cookies and similar technologies to enhance your browsing experience, and analytics to understand our traffic. By clicking "Allow All", you consent to optional analytics. Cookie Policy

The Lab