diff --git a/server/user/src/util/Token.ts b/server/user/src/util/Token.ts index f3cfa391..69b7e334 100644 --- a/server/user/src/util/Token.ts +++ b/server/user/src/util/Token.ts @@ -40,10 +40,13 @@ export async function GenToken( }, ], }) + await session.deleteMany({ + userID: new ObjectId(userID), + }) const sessionID = await session.insertOne({ createdAt: new Date(expTime), updatedAt: new Date(), - userID: userID, + userID: new ObjectId(userID), }) const exp = getNumericDate(expTime) const jwt = await create(