Skip to content

Commit

Permalink
fix issue with success endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
ajluker committed Jul 26, 2024
1 parent 58fd053 commit b15e487
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions web/oidc-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ const oidcRouter = Router();

oidcRouter.get('/login', passport.authenticate('login.lescommuns.org'));

oidcRouter.get('/success', (_req, res) =>
oidcRouter.get('/success', async (req, res) => {
console.log('User logged in', JSON.stringify(req.user));
await createOrUpdate(req.user);
res
.status(200)
.set('Content-Type', 'text/html')
.send(readFileSync(join(STATIC_PATH, 'success.html')))
);
});

oidcRouter.get(
'/callback',
Expand All @@ -36,11 +38,4 @@ oidcRouter.get(
})
);

oidcRouter.get('/success', async (req, res) => {
console.log("User has logged in", JSON.stringify(req.user));
await createOrUpdate(req.user);

res.json({ success: true, user: req.user });
});

export { oidcRouter };

0 comments on commit b15e487

Please sign in to comment.