diff --git a/backend/middlewares/auth.ts b/backend/middlewares/auth.ts index 2c4d3d304..9e70990dd 100644 --- a/backend/middlewares/auth.ts +++ b/backend/middlewares/auth.ts @@ -75,6 +75,7 @@ function authenticateWithBody( } return { + type: "Bearer", uid, }; } @@ -110,6 +111,7 @@ async function authenticateWithBearerToken( const decodedToken = await verifyIdToken(token); return { + type: "Bearer", uid: decodedToken.uid, email: decodedToken.email, }; @@ -169,6 +171,7 @@ async function authenticateWithApeKey( await ApeKeysDAO.updateLastUsedOn(keyOwner, keyId); return { + type: "ApeKey", uid, email: keyOwner.email, }; diff --git a/backend/types/types.d.ts b/backend/types/types.d.ts index 269c2d976..906ea829b 100644 --- a/backend/types/types.d.ts +++ b/backend/types/types.d.ts @@ -27,6 +27,7 @@ declare namespace MonkeyTypes { } interface DecodedToken { + type?: "Bearer" | "ApeKey"; uid?: string; email?: string; }