createAuthRequest

suspend fun createAuthRequest(state: String, authorizationDetails: Set<AuthorizationDetails>? = null, scope: String? = null, resource: String? = null): AuthenticationRequestParameters(source)

Send the result as parameters (either POST or GET) to the server at /authorize (or more specific OAuth2AuthorizationServerMetadata.authorizationEndpoint).

Sample ktor code:

val authnRequest = client.createAuthRequest(...)
val authnResponse = httpClient.get(issuerMetadata.authorizationEndpointUrl!!) {
url {
authnRequest.encodeToParameters().forEach { parameters.append(it.key, it.value) }
}
}
val authn = AuthenticationResponseParameters.deserialize(authnResponse.bodyAsText()).getOrThrow()

Parameters

state

to keep internal state in further requests

scope

in OID4VCI flows the value scope from IssuerMetadata.supportedCredentialConfigurations

authorizationDetails

from RFC 9396 OAuth 2.0 Rich Authorization Requests

resource

from RFC 8707 Resource Indicators for OAuth 2.0, in OID4VCI flows the value of IssuerMetadata.credentialIssuer