Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Replace generic error with BadRequestError for missing refresh token in exchange

Tuan Dang8d82e2d0fcce
diff --git a/backend/src/controllers/v1/authController.ts b/backend/src/controllers/v1/authController.ts
index 311d9602d4..c3ab670b6f 100644
--- a/backend/src/controllers/v1/authController.ts
+++ b/backend/src/controllers/v1/authController.ts
@@ -244,9 +244,9 @@ export const checkAuth = async (req: Request, res: Response) => {
export const getNewToken = async (req: Request, res: Response) => {
const refreshToken = req.cookies.jid;
- if (!refreshToken) {
- throw new Error("Failed to find refresh token in request cookies");
- }
+ if (!refreshToken) throw BadRequestError({
+ message: "Failed to find refresh token in request cookies"
+ });
const decodedToken = <jwt.UserIDJwtPayload>(
jwt.verify(refreshToken, await getJwtRefreshSecret())