Skip to content

Commit

Permalink
fix: pass error to next instead of modifying response
Browse files Browse the repository at this point in the history
  • Loading branch information
bayotop authored and kodiakhq[bot] committed Jun 30, 2021
1 parent 28e32ea commit e5adb3f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/authenticationMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function validateAudience(audience: string | undefined): void {

export const authenticationMiddleware = (opts: Options) => async (
req: Request,
res: Response,
_: Response,
next: NextFunction,
) => {
// Handle deprecated options
Expand All @@ -51,6 +51,7 @@ export const authenticationMiddleware = (opts: Options) => async (
next();
} catch (err) {
console.log("IAP validation failed", err);
res.status(403).json({ message: "IAP validation failed", err });
err.status = 403;
next(err);
}
};

0 comments on commit e5adb3f

Please sign in to comment.