aboutsummaryrefslogtreecommitdiff
path: root/routes/index.js
diff options
context:
space:
mode:
authornanalelfe <nargiza.nosirova@mail.utoronto.ca>2016-07-27 01:45:42 +0000
committernanalelfe <nargiza.nosirova@mail.utoronto.ca>2016-07-27 01:45:42 +0000
commit3b002a6fb136b9e7e534ffbcfedabed72fcd373d (patch)
treed24c3cb1f9e0283de25c32259f692745c6b19bc1 /routes/index.js
parent25706820837bd05cdc3b186eb1d5ebabf9688a61 (diff)
Added passport-facbeook
Diffstat (limited to 'routes/index.js')
-rw-r--r--routes/index.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/routes/index.js b/routes/index.js
index 219b7b7..38f02fa 100644
--- a/routes/index.js
+++ b/routes/index.js
@@ -246,6 +246,21 @@ router.get('/solutions/:exam_id/:q_num', function (req, res) {
});
});
+// Redirect the user to Facebook for authentication. When complete,
+// Facebook will redirect the user back to the application at
+// /auth/facebook/callback
+app.get('/auth/facebook', passport.authenticate('facebook'));
+
+// Facebook will redirect the user to this URL after approval. Finish the
+// authentication process by attempting to obtain an access token. If
+// access was granted, the user will be logged in. Otherwise,
+// authentication has failed.
+app.get('/auth/facebook/callback',
+ passport.authenticate('facebook', { successRedirect: '/user/user_profile',
+ failureRedirect: '/signin' }));
+
+
+
/**** Helpers ****/
function addFirstAdmin() {