fixed runtime errors

This commit is contained in:
Wyatt Johnson
2018-02-15 10:23:27 -07:00
parent 214d9e5047
commit 376ffd8486
11 changed files with 193 additions and 196 deletions
@@ -1,26 +1,28 @@
module.exports = router => {
const { passport, HandleAuthPopupCallback } = require('services/passport');
/**
* Facebook auth endpoint, this will redirect the user immediatly to facebook
* Facebook auth endpoint, this will redirect the user immediately to facebook
* for authorization.
*/
router.get(
'/api/v1/auth/facebook',
passport.authenticate('facebook', {
router.get('/api/v1/auth/facebook', (req, res, next) => {
const { connectors: { services: { Passport } } } = req.context;
return Passport.authenticate('facebook', {
display: 'popup',
authType: 'rerequest',
scope: ['public_profile'],
})
);
})(req, res, next);
});
/**
* Facebook callback endpoint, this will send the user a html page designed to
* send back the user credentials upon sucesfull login.
* send back the user credentials upon successful login.
*/
router.get('/api/v1/auth/facebook/callback', (req, res, next) => {
const { connectors: { services: { Passport } } } = req.context;
const { HandleAuthPopupCallback } = Passport;
// Perform the facebook login flow and pass the data back through the opener.
passport.authenticate(
Passport.authenticate(
'facebook',
{ session: false },
HandleAuthPopupCallback(req, res, next)