diff --git a/packages/client/lib/OpenID4VCIClient.ts b/packages/client/lib/OpenID4VCIClient.ts index fe90709a..53aa2eaa 100644 --- a/packages/client/lib/OpenID4VCIClient.ts +++ b/packages/client/lib/OpenID4VCIClient.ts @@ -116,7 +116,6 @@ export class OpenID4VCIClient { const queryObj: { [key: string]: string } = { response_type: ResponseType.AUTH_CODE, - client_id: this.clientId || '', code_challenge_method: codeChallengeMethod, code_challenge: codeChallenge, authorization_details: JSON.stringify(this.handleAuthorizationDetails(authorizationDetails)), @@ -124,6 +123,10 @@ export class OpenID4VCIClient { scope: scope, }; + if (this.clientId) { + queryObj['client_id'] = this.clientId; + } + if (this.credentialOffer.issuerState) { queryObj['issuer_state'] = this.credentialOffer.issuerState; } @@ -167,7 +170,6 @@ export class OpenID4VCIClient { const queryObj: { [key: string]: string } = { response_type: ResponseType.AUTH_CODE, - client_id: this.clientId || '', code_challenge_method: codeChallengeMethod, code_challenge: codeChallenge, authorization_details: JSON.stringify(this.handleAuthorizationDetails(authorizationDetails)), @@ -175,6 +177,10 @@ export class OpenID4VCIClient { scope: scope, }; + if (this.clientId) { + queryObj['client_id'] = this.clientId; + } + if (this.credentialOffer.issuerState) { queryObj['issuer_state'] = this.credentialOffer.issuerState; }