Skip to content

Commit

Permalink
Add client_id only if it was provided during client initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Linas Išganaitis committed Oct 7, 2023
1 parent 52f715f commit a73afee
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/client/lib/OpenID4VCIClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,17 @@ 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)),
redirect_uri: redirectUri,
scope: scope,
};

if (this.clientId) {
queryObj['client_id'] = this.clientId;
}

if (this.credentialOffer.issuerState) {
queryObj['issuer_state'] = this.credentialOffer.issuerState;
}
Expand Down Expand Up @@ -167,14 +170,17 @@ 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)),
redirect_uri: redirectUri,
scope: scope,
};

if (this.clientId) {
queryObj['client_id'] = this.clientId;
}

if (this.credentialOffer.issuerState) {
queryObj['issuer_state'] = this.credentialOffer.issuerState;
}
Expand Down

0 comments on commit a73afee

Please sign in to comment.