Okay, I have setup 2 applications, one is an angularjs application that is scaffoled by yeoman, that runs on port 8888
in localhost and one is an express rest api, that runs on port 3333
in localhost.
I have managed to connect them using a proxy (Grunt Connect Proxy), and able to access any resource using $resource
in angularjs, but the problem arises when I implemented authentication.
I am using passportjs, it works well when I am accessing the auth like so:
in the browser:
http://localhost:3333/auth/facebook
It opens a pop up and authenticate me, but when I do access it on the localhost:8888/api/auth/facebook
it tells me that I hit cross origin policy. I enabled CORS, and I am sure that is not the problem, I think the problem lies on the callback:
module.exports = {
'facebook': {
'clientID' : 'xxxxxxxxxxxxxxxx',
'clientSecret': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'callbackURL' : 'http://localhost:3000/auth/facebook/callback'
}
}