Authorization Code Flow

This flow covers your application creating a credential offer, the wallet redirecting the holder to an external IdP to authenticate, and the Issuer2 Service mapping the returned ID token claims into the credential. Set "authMethod": "AUTHORIZED" when creating the offer to use it.

Components involved:

  • Your Application — creates the credential offer and displays the QR code.
  • Wallet (Holder) — scans the QR code, redirects the holder to log in, completes the flow.
  • Issuer2 Service — manages the issuance session, correlates issuer_state, applies idTokenClaimsMapping, and signs the credential.
  • External IdP — authenticates the holder and issues the ID token, configured via authProviderConfiguration on the issuer service.

This flow requires an external OAuth/OIDC provider configured via authProviderConfiguration when creating the issuer service before you create an AUTHORIZED offer.

Loading diagram...

This diagram is a simplified overview focused on how the Issuer2 Service behaves. It omits some protocol details (e.g. metadata discovery of the Nonce Endpoint, PKCE, and the separate authorization-server metadata fetch). For the complete, normative sequence see the OpenID for Verifiable Credential Issuance 1.0 specification.

Protecting Authorization Codes With PKCE

Use Proof Key for Code Exchange (PKCE) to bind the issuer's authorization code to the wallet that started the request. The Issuer2 Service supports S256 and advertises it in authorization server metadata as code_challenge_methods_supported.

  1. Generate a fresh, cryptographically random code_verifier for each authorization request. Use 43–128 characters from A–Z, a–z, 0–9, -, ., _, and ~, and keep it secret in the wallet.
  2. Compute code_challenge as the base64url encoding of the SHA-256 hash of the verifier's ASCII bytes, without padding. Send code_challenge and code_challenge_method=S256 to the authorization_endpoint advertised in authorization server metadata. If using PAR, include them in the pushed request and use the returned request_uri at authorization.
  3. Send the original code_verifier when exchanging the returned authorization code at the advertised token_endpoint.

PKCE is optional by default (requirePkce is false, including on existing issuer resources where the field is absent). A supplied challenge always requires its matching verifier, including when enforcement is disabled. If the authorization request has no challenge, omit code_verifier during the code exchange; supplying one is rejected.

To require PKCE for an issuer, include this field alongside the other service settings when creating the service or updating its configuration:

{
  "requirePkce": true
}

When required, an authorization or PAR request without a challenge returns invalid_request. Enabling the requirement also rejects outstanding codes issued without PKCE. An incorrect verifier returns invalid_grant; a PKCE rejection during code exchange consumes the code, so restart authorization instead of retrying that code.

Understanding issuer_state

issuer_state is how the Issuer2 Service correlates the authorization request it receives back at .../openid4vci/authorize with the issuance session created when the offer was made. Set "issuerStateMode": "INCLUDE" when creating the offer to include it.

AUTHORIZED offers omit issuer_state unless issuerStateMode is INCLUDE. Because per-offer overrides need this correlation, an AUTHORIZED offer that uses runtimeOverrides must set issuerStateMode to INCLUDE — see Runtime Overrides.

Last updated on November 26, 2026