Skip to content

Commit

Permalink
fix: access token client_id not always set
Browse files Browse the repository at this point in the history
  • Loading branch information
nklomp committed Feb 18, 2025
1 parent a3ef03e commit 4b09936
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/issuer-rest/lib/OID4VCIServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
OID4VCICredentialFormat,
QRCodeOpts,
} from '@sphereon/oid4vci-common'
import { CredentialSupportedBuilderV1_13, ITokenEndpointOpts, VcIssuer, VcIssuerBuilder } from '@sphereon/oid4vci-issuer'
import { CredentialSupportedBuilderV1_13, ITokenEndpointOpts, oidcAccessTokenVerifyCallback, VcIssuer, VcIssuerBuilder } from '@sphereon/oid4vci-issuer'
import { ExpressSupport, HasEndpointOpts, ISingleEndpointOpts } from '@sphereon/ssi-express-support'
import express, { Express } from 'express'

Expand Down Expand Up @@ -179,7 +179,7 @@ export class OID4VCIServer {
deleteCredentialOfferEndpoint(this.router, this.issuer, opts?.endpointOpts?.deleteCredentialOfferOpts)
}
getCredentialOfferEndpoint(this.router, this.issuer, opts?.endpointOpts?.getCredentialOfferOpts)
getCredentialEndpoint(this.router, this.issuer, { ...opts?.endpointOpts?.tokenEndpointOpts, baseUrl: this.baseUrl })
getCredentialEndpoint(this.router, this.issuer, { ...opts?.endpointOpts?.tokenEndpointOpts, baseUrl: this.baseUrl, accessTokenVerificationCallback: opts.endpointOpts?.tokenEndpointOpts?.accessTokenVerificationCallback ?? (this._asClientOpts ? oidcAccessTokenVerifyCallback({clientMetadata: this._asClientOpts, credentialIssuer: this._issuer.issuerMetadata.credential_issuer, authorizationServer: this._issuer.issuerMetadata.authorization_servers![0]}) : undefined)})
this.assertAccessTokenHandling()
if (!this.isTokenEndpointDisabled(opts?.endpointOpts?.tokenEndpointOpts, opts?.asClientOpts)) {
accessTokenEndpoint(this.router, this.issuer, { ...opts?.endpointOpts?.tokenEndpointOpts, baseUrl: this.baseUrl })
Expand Down
3 changes: 2 additions & 1 deletion packages/issuer/lib/VcIssuer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export class VcIssuer {
statusListOpts?: Array<StatusListOpts>
sessionLifeTimeInSec?: number
}): Promise<CreateCredentialOfferURIResult> {
const { offerMode = 'VALUE', correlationId = shortUUID.generate(), credential_configuration_ids, statusListOpts, credentialOfferUri } = opts
const { offerMode = 'VALUE', correlationId = shortUUID.generate(), credential_configuration_ids, statusListOpts, credentialOfferUri, redirectUri } = opts
if (offerMode === 'REFERENCE' && !credentialOfferUri) {
return Promise.reject(Error('credentialOfferUri must be supplied for offerMode REFERENCE!'))
}
Expand Down Expand Up @@ -263,6 +263,7 @@ export class VcIssuer {

const status = IssueStatus.OFFER_CREATED
const session: CredentialOfferSession = {
redirectUri,
preAuthorizedCode,
issuerState,
createdAt,
Expand Down
1 change: 1 addition & 0 deletions packages/oid4vci-common/lib/types/StateManager.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface CredentialOfferSession extends StateType {
issuerState?: string; //todo: Probably good to hash it here, since it would come in from the client and we could match the hash and thus use the client value
preAuthorizedCode?: string; //todo: Probably good to hash it here, since it would come in from the client and we could match the hash and thus use the client value
authorizationCode?: string;
redirectUri?: string;
statusLists?: Array<StatusListOpts>;
}

Expand Down

0 comments on commit 4b09936

Please sign in to comment.