It\'s been two days and a million tries to enable CORS when trying to authenticate a user with Facebook using Passport in NodeJS/Express.
The error I get on Chrome i
I had also a problem with facebook login and cors but not with Passport in NodeJS/Express, my application is java(spring mvc)+ angular. I've managed to pass over the problem modifying my initial fb login function:
$scope.loginWithFacebook = function () {
$http({
method: 'GET',
url: 'auth/facebook',
dataType: 'jsonp'
}).success(function(data){
console.log('loginWithFacebook success: ', data);
}).error(function(data, status, headers, config) {
console.log('loginWithFacebook error: ', data);
});
}
with
$scope.loginWithFacebook = function() {
$window.location = $window.location.protocol + "//" + $window.location.host + $window.location.pathname + "auth/facebook";
};
Hope it helps!