I am using node with express as a server for my single page application (I am using AngularJS but this isn't related to the question). I need to add authentication abilities using passportJS or everyauth. I cannot use other package. I tried a many times to make the authentication work on my single page application but I didn't managed to do it without page refreshes. I am looking for a way to connect with facebook and this is the my front-end code:
function facebookLogin(callback) {
FB.login(function (response) {
if (!response.authResponse) {
console.log('Facebook login failed', response);
callback(false, response);
} else {
console.log('Facebook login complete', response);
callback(true, response);
}
});
}
facebookLogin(function(isConnected, response) {
if (isConnected) {
// HERE I NEED TO CALL SERVER SIDE AND CONNECT USING PASSPORT OR EVERYAUTH
// I WANT TO DO IT WITHOUT PAGE REFRESH
}
});
Any idea how can I do it? Or somewhere with an example? Remember, I need to connect without page refresh.