diff --git a/src/web/v1/index.ts b/src/web/v1/index.ts index 1c44d4a..33bf6de 100644 --- a/src/web/v1/index.ts +++ b/src/web/v1/index.ts @@ -38,6 +38,7 @@ V1.post("/db/:database/query", async (ctx) => { if (authkey && db.publickey) { let res = await verifyJWT(authkey, db.publickey); + if (res && !res.uid && res.user) res.uid = res.user; if (!res || !res.uid) { throw new BadRequestError("Invalid JWT"); } else { diff --git a/src/websocket.ts b/src/websocket.ts index 4293ad1..4ed7419 100644 --- a/src/websocket.ts +++ b/src/websocket.ts @@ -55,6 +55,7 @@ export class WebsocketConnectionManager { const authkey = query.get("authkey"); if (authkey && db.publickey) { let res = await verifyJWT(authkey, db.publickey); + if (res && !res.uid && res.user) res.uid = res.user; if (!res || !res.uid) { sendError("Invalid JWT"); socket.close();