createAuthRequest

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

Send the result as parameters to the server at OAuth2AuthorizationServerMetadata.authorizationEndpoint. Use POST if OAuth2AuthorizationServerMetadata.pushedAuthorizationRequestEndpoint is available.

Wraps the actual authorization request in a pushed authorization request (i.e. the request property), if the signPushedAuthorizationRequest is available.

Sample ktor code for GET:

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

Sample ktor code for POST:

val authnRequest = client.createAuthRequest(...)
httpClient.submitForm(
url = issuerMetadata.pushedAuthorizationRequestEndpoint,
formParameters = parameters {
authnRequest.encodeToParameters().forEach { append(it.key, it.value) }
}
)

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

issuerState

for OID4VCI flows the value from CredentialOfferGrantsAuthCode.issuerState