diff --git a/adminSiteServer/authentication.ts b/adminSiteServer/authentication.ts index 47033fcdfb..f92d24ed22 100644 --- a/adminSiteServer/authentication.ts +++ b/adminSiteServer/authentication.ts @@ -1,3 +1,4 @@ +import * as Sentry from "@sentry/node" import express from "express" import crypto from "crypto" import randomstring from "randomstring" @@ -87,7 +88,7 @@ export async function authCloudflareSSOMiddleware( .knexInstance() .table("users") .where({ email: payload.email }) - .first() + .first() if (!user) { console.error( `User with email ${payload.email} not found. Please contact an administrator.` @@ -97,6 +98,13 @@ export async function authCloudflareSSOMiddleware( // Authenticate as the user stored in the token const { id: sessionId } = await logInAsUser(user) + + Sentry.setUser({ + id: user.id, + email: user.email, + username: user.fullName, + }) + res.cookie("sessionid", sessionId, { httpOnly: true, sameSite: "lax",