Skip to content

OpenID Connect flows, response modes, claims and logout

This page is for operators and realm administrators. It covers what the authorization endpoint of a realm (/realms/<realm>/oauth2/authorize) accepts, and which claims the tokens and userinfo carry. The behaviour follows OpenID Connect Core 1.0, OAuth 2.0 Multiple Response Type Encoding Practices and OAuth 2.0 Form Post Response Mode.

Response types

response_type Flow Available to
code Authorization code (recommended; PKCE for public clients) every client with the authorization_code grant
id_token, id_token token Implicit (Core §3.2) clients with the implicit grant only
code id_token, code token, code id_token token Hybrid (Core §3.3) clients with the implicit grant only

Discovery (response_types_supported, grant_types_supported) lists the implicit and hybrid response types and the implicit grant only in a realm where a client can use them. That is a realm where a client has the implicit grant, or where Dynamic Client Registration may register it.

The implicit and hybrid flows are off by default

These flows return tokens through the browser, so OAuth 2.1 and FAPI no longer recommend them. They are there for OpenID Connect relying parties that cannot use the code flow. To switch them on for one client:

  • Console: open Clients → the client → Credentials and tick Implicit and hybrid flows (legacy).
  • Admin API: add implicit to the client's grantTypes.

HelixIAM refuses the switch (400, field grantTypes) in these cases:

Code Why
implicitNeedsCode The client must also have the authorization_code grant. Both flows are built on the authorization endpoint's code issuance.
implicitNotFapi The client requires a signed request object, certificate-bound access tokens or a JARM response mode. FAPI allows the code flow only.
implicitHighAssurance The realm uses the HIGH key-custody profile.

Dynamic Client Registration. A registration that asks for a response type with id_token or token (or for the implicit grant) needs the implicit grant. The realm administrator must allow that grant for registration (Provisioning → Dynamic Client Registration → allowed grant types → Implicit and hybrid (legacy)). It is never allowed by default. Such a client is registered with the authorization_code grant as well, and the registration response reports both.

What the authorization endpoint checks and returns

  • redirect_uri: must be one of the client's registered redirect URIs, compared exactly.
  • nonce: required whenever an ID token comes from the authorization endpoint (Core §3.2.2.1, §3.3.2.11).
  • Scope: openid is required.
  • Response mode:
  • fragment is the default.
  • form_post is also accepted.
  • query is refused (invalid_request): tokens are never put in a query string.
  • Errors: sent back in the same response mode as a success would be.
  • The ID token from the authorization endpoint:
  • carries nonce, at_hash with an access token and c_hash with a code;
  • the hash is that of the ID token's signing algorithm;
  • it carries the standard claims of the granted scopes.
  • The access token from the authorization endpoint:
  • lives at most 5 minutes;
  • no refresh token is ever issued with it.
  • Hybrid flow: the code is redeemed at the token endpoint as usual, with PKCE when the client sent a code_challenge.
  • Implicit flow: the code is never sent to the client.
  • Behind a reverse proxy: these responses carry the tokens in the Location header of the redirect. With many claims that header exceeds the 4–8 KB response-header buffer some proxies default to, and the proxy answers 502:
  • nginx: proxy_buffer_size 32k; proxy_buffers 8 32k;
  • ingress-nginx: the annotation nginx.ingress.kubernetes.io/proxy-buffer-size: "32k"
  • Everything else is the same as the code flow: sign-in, prompt, max_age, consent, MFA, the session binding (sid, auth_time, acr) and the audit trail.

prompt and max_age in signed and pushed requests

  • Signed request object (request, RFC 9101): prompt and max_age are read from the request object.
  • Pushed authorization request (request_uri, RFC 9126): prompt and max_age are the pushed ones, and an error goes to the pushed redirect_uri with the pushed state.
  • An unsigned value of either in the query string next to a request object or a request_uri is ignored.

Response modes

response_mode For
query code (the default)
fragment implicit and hybrid (the default)
form_post every response type (OAuth 2.0 Form Post Response Mode)

With form_post, the authorization endpoint answers with a page whose form POSTs the response parameters to the redirect URI. The page submits itself with a script served by HelixIAM, and its content security policy only allows a form to the redirect URI's origin.

Claims

The standard claims of the profile, email, address and phone scopes (OpenID Connect Core §5.4) are released only when that scope is granted. A claim named in the claims request parameter (§5.5) is released too:

  • a claim named under id_token goes into the ID token;
  • a claim named under userinfo comes from userinfo.

The values have the JSON types of §5.1:

  • email_verified and phone_number_verified are booleans;
  • updated_at is seconds since the epoch, the last change of the account;
  • address is one JSON object.

Claims outside these scopes (custom attributes released by the claim mapping, roles, organizations) are not affected.

Roles are in the access token, not the ID token

The user's roles (realm_access.roles and resource_access.<client>.roles) are in the access token and in the userinfo response. They are in the ID token only for a client with Roles in the ID token switched on (see OIDC client settings):

Client Roles in its ID tokens
Created after the upgrade to 1.1.9 (console, admin API, import, Dynamic Client Registration) No, until you switch the setting on
Existing before that upgrade Yes, until you switch the setting off

What else the ID token carries by default:

  • The BSN is never in a token. Not in the ID token, the access token or userinfo.
  • Groups are in the ID token only through a protocol mapper with Add to ID token ticked.
  • Organizations are in tokens only when the organizations scope is granted.
  • Profile, email, address and phone claims follow the granted scopes (above).
  • Protocol mappers keep their Add to ID token and Add to access token choices.

RP-initiated logout

The end-session endpoint of a realm is /realms/<realm>/connect/logout (end_session_endpoint in discovery). It follows OpenID Connect RP-Initiated Logout 1.0 and accepts GET and POST.

Request What happens
A valid id_token_hint The user is signed out straight away.
No id_token_hint, signed in The user is asked "Do you want to sign out?" first (below).
No id_token_hint, not signed in in this browser The "You're signed out" page. There is nothing to end.
An id_token_hint that is not valid, or an unknown client_id The error page "This sign-out link is not valid". Nothing is ended.

The confirmation page. Without a hint, HelixIAM cannot be sure the request comes from the user, so it asks. The page uses the realm's theme and the user's language. It names the application when the request has a known client_id. It has two buttons:

  • Sign out (focused, so Enter answers it). The session ends as with a hint: the sign-in session and its tokens end, and back-channel and front-channel logout reach every application of the session.
  • Stay signed in. Nothing ends, and the page says "You're still signed in".

The answer is a form post protected by the session's CSRF token, so another site cannot answer for the user.

Where the browser goes after Sign out.

  • To post_logout_redirect_uri, with state added, only when that exact URI is registered for the client_id of the request.
  • Otherwise to the realm's "You're signed out" page: without client_id, without a URI, or with a URI that is not registered for that client. An unregistered URI is never used, and is logged.

Example without a hint:

GET /realms/acme/connect/logout
  ?client_id=acme-web
  &post_logout_redirect_uri=https://app.example.com/
  &state=$STATE

See also