mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-03-10 05:35:05 +08:00
added decoded token types
This commit is contained in:
parent
f221326f47
commit
16a982e71e
2 changed files with 4 additions and 0 deletions
|
@ -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,
|
||||
};
|
||||
|
|
1
backend/types/types.d.ts
vendored
1
backend/types/types.d.ts
vendored
|
@ -27,6 +27,7 @@ declare namespace MonkeyTypes {
|
|||
}
|
||||
|
||||
interface DecodedToken {
|
||||
type?: "Bearer" | "ApeKey";
|
||||
uid?: string;
|
||||
email?: string;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue