createCredentialRequest
Send the result as JSON-serialized content to the server at /credential
(or more specific IssuerMetadata.credentialEndpointUrl).
Also send along the TokenResponseParameters.accessToken from the token response in HTTP header Authorization
see TokenResponseParameters.toHttpHeaderValue.
Be sure to include a DPoP header if TokenResponseParameters.tokenType is DPoP
, see buildDPoPHeader.
See OAuth2Client.createTokenRequestParameters.
Sample ktor code:
val tokenResponse = ...
val credentialRequest = client.createCredentialRequest(
tokenResponse = tokenResponse,
credentialIssuer = issuerMetadata.credentialIssuer
).getOrThrow()
val credentialResponse = httpClient.post(issuerMetadata.credentialEndpointUrl) {
setBody(credentialRequest)
headers {
append(HttpHeaders.Authorization, tokenResponse.toHttpHeaderValue())
}
}
Parameters
from the authorization server token endpoint
the issuer's metadata, see IssuerMetadata
which credential to request (needed to build the correct proof)
if required by the issuer (see IssuerMetadata.nonceEndpointUrl), the value from there, exactly ClientNonceResponse.clientNonce
the scope
value requested in the token request, since the authorization server may not set it in tokenResponse
Deprecated
Removed in OID4VCI draft 15
Replace with
createCredentialRequest(tokenResponse, credentialIssuer)