diff --git a/server/routes/auth.ts b/server/routes/auth.ts index 76a519fe..97c0c55e 100644 --- a/server/routes/auth.ts +++ b/server/routes/auth.ts @@ -549,6 +549,11 @@ authRoutes.post('/plex/profile/select', async (req, res, next) => { // Use the existing user profileUser = existingEmailUser; + + if (req.session) { + req.session.userId = profileUser.id; + } + return res.status(200).json(profileUser.filter() ?? {}); } else { // Then check for any other potential matches const allUsers = await userRepository.find(); @@ -566,6 +571,11 @@ authRoutes.post('/plex/profile/select', async (req, res, next) => { }); profileUser = matchingUser; + + if (req.session) { + req.session.userId = matchingUser.id; + } + return res.status(200).json(matchingUser.filter() ?? {}); } else { // Create a new profile user profileUser = new User({