Skip to content

Commit 4b09936

Browse files
committed
fix: access token client_id not always set
1 parent a3ef03e commit 4b09936

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

packages/issuer-rest/lib/OID4VCIServer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
OID4VCICredentialFormat,
99
QRCodeOpts,
1010
} from '@sphereon/oid4vci-common'
11-
import { CredentialSupportedBuilderV1_13, ITokenEndpointOpts, VcIssuer, VcIssuerBuilder } from '@sphereon/oid4vci-issuer'
11+
import { CredentialSupportedBuilderV1_13, ITokenEndpointOpts, oidcAccessTokenVerifyCallback, VcIssuer, VcIssuerBuilder } from '@sphereon/oid4vci-issuer'
1212
import { ExpressSupport, HasEndpointOpts, ISingleEndpointOpts } from '@sphereon/ssi-express-support'
1313
import express, { Express } from 'express'
1414

@@ -179,7 +179,7 @@ export class OID4VCIServer {
179179
deleteCredentialOfferEndpoint(this.router, this.issuer, opts?.endpointOpts?.deleteCredentialOfferOpts)
180180
}
181181
getCredentialOfferEndpoint(this.router, this.issuer, opts?.endpointOpts?.getCredentialOfferOpts)
182-
getCredentialEndpoint(this.router, this.issuer, { ...opts?.endpointOpts?.tokenEndpointOpts, baseUrl: this.baseUrl })
182+
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)})
183183
this.assertAccessTokenHandling()
184184
if (!this.isTokenEndpointDisabled(opts?.endpointOpts?.tokenEndpointOpts, opts?.asClientOpts)) {
185185
accessTokenEndpoint(this.router, this.issuer, { ...opts?.endpointOpts?.tokenEndpointOpts, baseUrl: this.baseUrl })

packages/issuer/lib/VcIssuer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export class VcIssuer {
180180
statusListOpts?: Array<StatusListOpts>
181181
sessionLifeTimeInSec?: number
182182
}): Promise<CreateCredentialOfferURIResult> {
183-
const { offerMode = 'VALUE', correlationId = shortUUID.generate(), credential_configuration_ids, statusListOpts, credentialOfferUri } = opts
183+
const { offerMode = 'VALUE', correlationId = shortUUID.generate(), credential_configuration_ids, statusListOpts, credentialOfferUri, redirectUri } = opts
184184
if (offerMode === 'REFERENCE' && !credentialOfferUri) {
185185
return Promise.reject(Error('credentialOfferUri must be supplied for offerMode REFERENCE!'))
186186
}
@@ -263,6 +263,7 @@ export class VcIssuer {
263263

264264
const status = IssueStatus.OFFER_CREATED
265265
const session: CredentialOfferSession = {
266+
redirectUri,
266267
preAuthorizedCode,
267268
issuerState,
268269
createdAt,

packages/oid4vci-common/lib/types/StateManager.types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export interface CredentialOfferSession extends StateType {
1919
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
2020
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
2121
authorizationCode?: string;
22+
redirectUri?: string;
2223
statusLists?: Array<StatusListOpts>;
2324
}
2425

0 commit comments

Comments
 (0)