diff --git a/packages/client/lib/OpenID4VCIClient.ts b/packages/client/lib/OpenID4VCIClient.ts index 5b789f67..f447fdbd 100644 --- a/packages/client/lib/OpenID4VCIClient.ts +++ b/packages/client/lib/OpenID4VCIClient.ts @@ -251,8 +251,11 @@ export class OpenID4VCIClient { code?: string; redirectUri?: string; }): Promise { - const { pin, clientId, codeVerifier, code, redirectUri } = opts ?? {}; + const { pin, clientId, code, redirectUri } = opts ?? {}; + if (opts?.codeVerifier) { + this._pkce.codeVerifier = opts.codeVerifier; + } this.assertIssuerData(); if (clientId) { @@ -266,7 +269,7 @@ export class OpenID4VCIClient { metadata: this.endpointMetadata, credentialIssuer: this.getIssuer(), pin, - codeVerifier, + ...(!this._pkce.disabled && { codeVerifier: this._pkce.codeVerifier }), code, redirectUri, asOpts: { clientId },