createAuthRequest

suspend fun createAuthRequest(state: String, credential: Pair<String, SupportedCredentialFormat>, credentialIssuer: String? = null, authorizationServers: Set<String>? = null): AuthenticationRequestParameters(source)

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

Sample ktor code:

val credentialConfig = issuerMetadata.supportedCredentialConfigurations!!
.entries.first { it.key == credentialOffer.configurationIds.first() }.toPair()
val authnRequest = client.createAuthRequest(
state = state,
credential = credentialConfig,
credentialIssuer = issuerMetadata.credentialIssuer,
authorizationServers = issuerMetadata.authorizationServers
)
val authnResponse = httpClient.get(issuerMetadata.authorizationEndpointUrl!!) {
url {
authnRequest.encodeToParameters().forEach { parameters.append(it.key, it.value) }
}
}
val authn = AuthenticationResponseParameters.deserialize(authnResponse.bodyAsText()).getOrThrow()

Parameters

credential

which credential from IssuerMetadata.supportedCredentialConfigurations to request

credentialIssuer
authorizationServers

suspend fun createAuthRequest(requestOptions: WalletService.RequestOptions, credentialIssuer: String? = null): AuthenticationRequestParameters(source)

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

Sample ktor code:

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

Parameters

requestOptions

which credential in which representation to request

credentialIssuer