Client Configuration
This page explains how to integrate the Verifier into a backend application by calling its REST API directly. The Verifier exposes endpoints for registering a verifier, creating OpenID4VP authorization requests, and tracking the resulting verification sessions. Your server authenticates with an OIDC bearer token and talks to the API over HTTPS — no client library is required.
The examples below use TypeScript with fetch running inside an Express server, but the same calls work from any HTTP client.
Prerequisites
Before issuing any verification request, make sure you have the following:
The Verifier base URL — the HTTPS origin where the Verifier API is served (for example
https://your-verifier.evdi.app). All paths below are relative to this origin.An OIDC access token — every non-public endpoint requires a valid JWT passed as
Authorization: Bearer <token>. The token is validated against the configured JWKS endpoint of your OIDC provider (such as Keycloak). The/agent/*routes used to register a verifier additionally require theadminrole; the authorization-request and verification-session routes require only a valid token.A
verifierId— the identifier of a verifier record you create once (see below) and then reuse for all authorization requests.
For local development without tokens, see the development bypass in Authentication.
Obtaining an access token
Request a token from your OIDC provider using the client-credentials grant (or any flow that yields a token carrying the admin role), then attach it to every call:
async function getAccessToken(): Promise<string> {
const res = await fetch('https://auth.example.com/realms/empe/protocol/openid-connect/token', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({
grant_type: 'client_credentials',
client_id: 'your-client-id',
client_secret: 'your-oidc-client-credentials-secret',
}),
});
const data = await res.json();
return data.access_token;
}For a One-Click deployment, obtain the token from your realm's Keycloak token endpoint —
https://<keycloak-host>/realms/<realm>/protocol/openid-connect/token— using the credentials shown when you created the deployment; see Authenticating to Your Deployment. If you run your own identity provider, use its token endpoint and a client you control (as shown above).
Registering a Verifier
A verifier record is created once and reused. Create it with the Agent API.
POST /agent/verifier
Request Body
verifierId(string, optional) A custom identifier for tracing (for exampleverifier-empe). If you omit it, the service assigns one. You do not need to supply a DID here; the signing DID is chosen later when you create authorization requests.
Response Body
verifierId(string) The identifier to use in subsequent authorization-request paths.clientMetadata(object, optional) OpenID4VP client metadata attached to the verifier.
Persist the returned verifierId in your configuration; you will reference it in every authorization request.
Creating an Authorization Request
To ask a wallet to present credentials, create an authorization request under your verifier. The request describes which credentials and claims you want, using either a DCQL query or a DIF Presentation Exchange v2 definition.
POST /verifiers/{verifierId}/authorization-requests
Request Body
Exactly one of dcqlQuery or presentationDefinition is required; the remaining fields are optional.
dcqlQuery(object) — a DCQL query describing the requested credential configurations and claims. Required ifpresentationDefinitionis not provided.presentationDefinition(object) — a DIF Presentation Exchange v2 definition. Required ifdcqlQueryis not provided. Can only be used withversionv1.draft21orv1.draft24.responseMode(string, optional) — one ofdirect_post,direct_post.jwt,dc_api,dc_api.jwt. Defaults todirect_post.jwt.version(string, optional) — OpenID4VP draft version:v1,v1.draft21, orv1.draft24. Defaults tov1, which supports onlydcqlQuery.signingDid(string, optional) — the DID that signs the authorization request. If omitted, theverifierIdin the path must itself be a DID (for example adid:webordid:keyregistered with the Agent API).authorizationResponseRedirectUri(string, optional) — a redirect URI to include in authorization responses.expectedOrigins(string array, optional) — expected origins for Digital Credentials API flows.transactionData(object array, optional) — transaction data entries to include in the request.verifierInfo(object array, optional) — verifier attestations to include in the request.
The following example requests an EmployeeBadge SD-JWT credential and asks the wallet to disclose only the employee_id and department claims:
Response Body
authorizationRequestUri(string) — anopenid4vp://...URI. Encode it into a QR code or use it as a deep link so a wallet can fetch and respond to the request.verificationSessionId(string) — the session identifier you poll or subscribe to in order to learn the outcome.authorizationRequestId(string, optional) — the identifier of the hosted request.expiresAt(string, optional) — ISO timestamp after which the request is no longer valid.
If you would rather receive a ready-to-render QR image, send the same body to POST /verifiers/{verifierId}/authorization-requests/qr-code. It returns a PNG and exposes the same values through the X-Authorization-Request-Uri, X-Verification-Session-Id, and X-Authorization-Request-Id response headers.
Reacting to Results
The response from a wallet is processed asynchronously, so your server watches the verification session and applies its own logic (issuing a login token, completing a checkout, granting access) once the session succeeds. There is no callback framework: you own this logic.
A session moves through these states:
RequestCreated— the request exists and is waiting for a wallet.RequestUriRetrieved— a wallet has fetched the request.ResponseVerified— the wallet returned a valid presentation. This is the success state.Error— verification failed; inspecterrorMessage.
Polling the session
GET /verification-sessions/{sessionId}
The response includes the session state, the verifierId, the authorization request URI, expiresAt, and an errorMessage when something went wrong:
When state reaches ResponseVerified, run your post-verification logic:
Subscribing with Server-Sent Events
To avoid polling, subscribe to live updates instead.
GET /verification-sessions/{sessionId}/events
This endpoint streams Server-Sent Events. It emits a session event carrying the full session object immediately on subscribe (reflecting the current state) and again on every state change, plus a ping heartbeat every 15 seconds to keep the connection alive. Close the stream once you observe a terminal state (ResponseVerified or Error).
This pattern lets your backend react the moment a wallet completes the presentation, without holding open long-running poll loops.
Last updated