2

I'm using passport with facebook strategy for authentication. Problem doesn't reside in the back-end which is nodejs, as i have tested without angularjs and everything works just fine, but whenever angularjs comes into play i'd get CORS error.

Access-Control-Allow-Origin header is present on the requested resource. Origin host:8000 is therefore not allowed access.

I have tried most of the solutions i have found via google, but nothing has really worked so far. Does anyone have an idea what might be wrong?

This is the most common answer usually to this sort of question as far as i understand.

site.config(function($httpProvider) {
    $httpProvider.defaults.useXDomain = true;
    delete $httpProvider.defaults.headers.common['X-Requested-With'];
});

And like i said, it is not nodejs fault.

4

1 回答 1

0

您需要使用弹出窗口来解决 Angular 的 CORS 问题。请参阅此帖子以获取示例:http ://www.webdeveasy.com/single-page-application-authentication/

于 2014-09-14T18:31:57.950 回答