Skip to content

Commit 5140e35

Browse files
parse accept and compare on env field
1 parent 3f6ba95 commit 5140e35

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/auth/auth.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,8 +420,11 @@ export class Verifier {
420420
): Promise<AuthorizationResponseMessage> {
421421
const msg = await this.packageManager.unpack(byteEncoder.encode(tokenStr));
422422

423-
if (request.body.accept?.length && !request.body.accept.includes(msg.unpackedMediaType)) {
424-
throw new Error('response media type is not accepted by request');
423+
if (request.body.accept?.length) {
424+
const acceptedMediaTypes = request.body.accept.map(accept => parseAcceptProfile(accept).env);
425+
if (!acceptedMediaTypes.includes(msg.unpackedMediaType)) {
426+
throw new Error('response media type is not accepted by request');
427+
}
425428
}
426429

427430
const response = msg.unpackedMessage as AuthorizationResponseMessage;

0 commit comments

Comments
 (0)