forked from freeCodeCamp/freeCodeCamp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Berkeley Martinez
authored and
Berkeley Martinez
committed
Jun 2, 2015
1 parent
7bb11e9
commit 7643f1c
Showing
7 changed files
with
83 additions
and
77 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
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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
var express = require('express'), | ||
passport = require('passport'), | ||
passportConf = require('../../config/passport'); | ||
|
||
var router = express.Router(); | ||
var passportOptions = { | ||
successRedirect: '/', | ||
failureRedirect: '/login' | ||
}; | ||
|
||
router.all('/account', passportConf.isAuthenticated); | ||
|
||
router.get('/auth/twitter', passport.authenticate('twitter')); | ||
|
||
router.get( | ||
'/auth/twitter/callback', | ||
passport.authenticate('twitter', { | ||
successRedirect: '/', | ||
failureRedirect: '/login' | ||
}) | ||
); | ||
|
||
router.get( | ||
'/auth/linkedin', | ||
passport.authenticate('linkedin', { | ||
state: 'SOME STATE' | ||
}) | ||
); | ||
|
||
router.get( | ||
'/auth/linkedin/callback', | ||
passport.authenticate('linkedin', passportOptions) | ||
); | ||
|
||
router.get( | ||
'/auth/facebook', | ||
passport.authenticate('facebook', {scope: ['email', 'user_location']}) | ||
); | ||
|
||
router.get( | ||
'/auth/facebook/callback', | ||
passport.authenticate('facebook', passportOptions), function (req, res) { | ||
res.redirect(req.session.returnTo || '/'); | ||
} | ||
); | ||
|
||
router.get('/auth/github', passport.authenticate('github')); | ||
|
||
router.get( | ||
'/auth/github/callback', | ||
passport.authenticate('github', passportOptions), function (req, res) { | ||
res.redirect(req.session.returnTo || '/'); | ||
} | ||
); | ||
|
||
router.get( | ||
'/auth/google', | ||
passport.authenticate('google', {scope: 'profile email'}) | ||
); | ||
|
||
router.get( | ||
'/auth/google/callback', | ||
passport.authenticate('google', passportOptions), function (req, res) { | ||
res.redirect(req.session.returnTo || '/'); | ||
} | ||
); | ||
|
||
module.exports = router; |
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
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