Skip to content

Commit

Permalink
fix: headers for error response
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <[email protected]>
  • Loading branch information
TimoGlastra committed Aug 1, 2024
1 parent 86d0423 commit 4c8319e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/client/lib/functions/dpopUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function shouldRetryTokenRequestWithDPoPNonce(response: OpenIDResponse<un
return { ok: false };
}

const dPoPNonce = response.errorBody.headers.get('DPoP-Nonce');
const dPoPNonce = response.origResponse.headers.get('DPoP-Nonce');
if (!dPoPNonce) {
throw new Error('Missing required DPoP-Nonce header.');
}
Expand All @@ -21,12 +21,12 @@ export function shouldRetryResourceRequestWithDPoPNonce(response: OpenIDResponse
return { ok: false };
}

const wwwAuthenticateHeader = response.errorBody.headers?.get('WWW-Authenticate');
const wwwAuthenticateHeader = response.origResponse.headers.get('WWW-Authenticate');
if (!wwwAuthenticateHeader?.includes(dpopTokenRequestNonceError)) {
return { ok: false };
}

const dPoPNonce = response.errorBody.headers.get('DPoP-Nonce');
const dPoPNonce = response.origResponse.headers.get('DPoP-Nonce');
if (!dPoPNonce) {
throw new Error('Missing required DPoP-Nonce header.');
}
Expand Down
2 changes: 1 addition & 1 deletion packages/oid4vci-common/lib/types/Generic.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export interface JsonLdIssuerCredentialDefinition {
credentialSubject?: IssuerCredentialSubject;
}

export interface ErrorResponse extends Response {
export interface ErrorResponse {
error: string;
error_description?: string;
error_uri?: string;
Expand Down

0 comments on commit 4c8319e

Please sign in to comment.