diff --git a/packages/client/lib/AccessTokenClient.ts b/packages/client/lib/AccessTokenClient.ts index 6e3f2c1f..d8302b34 100644 --- a/packages/client/lib/AccessTokenClient.ts +++ b/packages/client/lib/AccessTokenClient.ts @@ -9,6 +9,7 @@ import { getIssuerFromCredentialOfferPayload, GrantTypes, IssuerOpts, + JsonURIMode, OpenIDResponse, PRE_AUTH_CODE_LITERAL, TokenErrorResponse, @@ -191,7 +192,7 @@ export class AccessTokenClient { } private async sendAuthCode(requestTokenURL: string, accessTokenRequest: AccessTokenRequest): Promise> { - return await formPost(requestTokenURL, convertJsonToURI(accessTokenRequest)); + return await formPost(requestTokenURL, convertJsonToURI(accessTokenRequest, { mode: JsonURIMode.X_FORM_WWW_URLENCODED })); } public static determineTokenURL({ diff --git a/packages/client/lib/OpenID4VCIClient.ts b/packages/client/lib/OpenID4VCIClient.ts index 617e8367..59b9ac36 100644 --- a/packages/client/lib/OpenID4VCIClient.ts +++ b/packages/client/lib/OpenID4VCIClient.ts @@ -319,7 +319,7 @@ export class OpenID4VCIClient { requestBuilder.withDeferredCredentialAwait(deferredCredentialAwait ?? false, deferredCredentialIntervalInMS); if (this.endpointMetadata?.credentialIssuerMetadata) { const metadata = this.endpointMetadata.credentialIssuerMetadata; - const types = Array.isArray(credentialTypes) ? [...credentialTypes].sort() : [credentialTypes]; + const types = Array.isArray(credentialTypes) ? credentialTypes : [credentialTypes]; if (metadata.credentials_supported && Array.isArray(metadata.credentials_supported)) { let typeSupported = false; @@ -327,7 +327,7 @@ export class OpenID4VCIClient { metadata.credentials_supported.forEach((supportedCredential) => { const subTypes = getTypesFromCredentialSupported(supportedCredential); if ( - subTypes.sort().every((t, i) => types[i] === t) || + subTypes.every((t, i) => types[i] === t) || (types.length === 1 && (types[0] === supportedCredential.id || subTypes.includes(types[0]))) ) { typeSupported = true;