fix: state cleanup
This commit is contained in:
parent
d1b3ee0009
commit
350c5d143a
|
@ -10,16 +10,16 @@ export default function userRoutes(app) {
|
||||||
});
|
});
|
||||||
app.get('/auth/reddit/callback', (req, res, next) => {
|
app.get('/auth/reddit/callback', (req, res, next) => {
|
||||||
if (req.query.state === req.session.state) {
|
if (req.query.state === req.session.state) {
|
||||||
passport.authenticate('reddit', {
|
delete req.session.state;
|
||||||
successRedirect: '/chat',
|
req.session.save((error) => {
|
||||||
failureRedirect: '/login',
|
|
||||||
})(req, res, (error) => {
|
|
||||||
if (error) {
|
if (error) {
|
||||||
next(error);
|
next(error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
delete req.session.state;
|
passport.authenticate('reddit', {
|
||||||
req.session.save(next);
|
successRedirect: '/chat',
|
||||||
|
failureRedirect: '/login',
|
||||||
|
})(req, res, next);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user