This bugs me for two days and I cannot find good example on the internet for this.
I have two routes for facebook authentication using passport js, so I have like:
app.get('/auth/facebook', passport.authenticate('facebook'));
app.get('/auth/facebook/callback',
passport.authenticate('facebook', {
'successRedirect': '/#/account',
'failureRedirect': '/'
})
);
Now I requested in this particular server through angularjs $http.post
, like so:
angular.module('whimApp')
.factory('AuthService', function ($http, API) {
return {
login: function() {
return $http.get(API + 'auth/facebook')
.then(function(res){
Session.create(res.id, res.user.id);
return res.user;
});
},
};
});
And I am getting this error:
https://localhost:3000/auth/facebooknet::ERR_SSL_PROTOCOL_ERROR
I wonder if how would I be able to just do:
app.get('/auth/github/callback',
passport.authenticate('facebook'),
// HERE is what i want to do
// if successful login return user
function(req,res,next) {
res.json(req.user);
}
);
Do you have any references there.