-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Route to controlled next path after social login
- Loading branch information
1 parent
1a9d027
commit 8dcb7d6
Showing
3 changed files
with
54 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,18 @@ | ||
import passport from 'passport'; | ||
|
||
export default { | ||
initFacebook: passport.authenticate('facebook', { | ||
scope: ['public_profile', 'email'], | ||
}), | ||
initLinkedin: passport.authenticate('linkedin', { | ||
state: Math.random(), | ||
}), | ||
initFacebook: (req, res, next) => ( | ||
passport.authenticate('facebook', { | ||
scope: ['public_profile', 'email'], | ||
state: JSON.stringify({ next: req.query.next }), | ||
})(req, res, next) | ||
), | ||
initLinkedin: (req, res, next) => ( | ||
passport.authenticate('linkedin', { | ||
state: JSON.stringify({ | ||
next: req.query.next, | ||
random: Math.random(), | ||
}), | ||
})(req, res, next) | ||
), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters