added decoded token types

This commit is contained in:
Miodec 2022-03-06 17:16:33 +01:00
parent f221326f47
commit 16a982e71e
2 changed files with 4 additions and 0 deletions

View file

@ -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,
};

View file

@ -27,6 +27,7 @@ declare namespace MonkeyTypes {
}
interface DecodedToken {
type?: "Bearer" | "ApeKey";
uid?: string;
email?: string;
}