createCredentialRequest

suspend fun createCredentialRequest(    tokenResponse: TokenResponseParameters,     metadata: IssuerMetadata,     credentialFormat: SupportedCredentialFormat,     clientNonce: String? = null,     previouslyRequestedScope: String? = null,     clock: Clock = Clock.System): KmmResult<Collection<CredentialRequestParameters>>(source)

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

tokenResponse

from the authorization server token endpoint

metadata

the issuer's metadata, see IssuerMetadata

credentialFormat

which credential to request (needed to build the correct proof)

clientNonce

if required by the issuer (see IssuerMetadata.nonceEndpointUrl), the value from there, exactly ClientNonceResponse.clientNonce

previouslyRequestedScope

the scope value requested in the token request, since the authorization server may not set it in tokenResponse


suspend fun createCredentialRequest(    input: WalletService.CredentialRequestInput,     clientNonce: String?,     credentialIssuer: String?,     clock: Clock = Clock.System): KmmResult<CredentialRequestParameters>(source)

Deprecated

Removed in OID4VCI draft 15

Replace with

createCredentialRequest(tokenResponse, credentialIssuer)