Response to preflight request doesn't pass access control check

I’m getting this error using ngResource to call a REST API on Amazon Web Services:

XMLHttpRequest cannot load
http://server.apiurl.com:8000/s/login?login=facebook. Response to
preflight request doesn’t pass access control check: No
‘Access-Control-Allow-Origin’ header is present on the requested
resource. Origin ‘http://localhost’ is therefore not allowed access.
Error 405

Service:

socialMarkt.factory('loginService', ['$resource', function ($resource) {
    var apiAddress = "http://server.apiurl.com:8000/s/login/";
    return $resource(apiAddress, {
        login: "facebook",
        access_token: "@access_token",
        facebook_id: "@facebook_id"
    }, {
        getUser: {
            method: 'POST'
        }
    });
}]);

Controller:

[...]
loginService.getUser(JSON.stringify(fbObj)),
    function (data) {
        console.log(data);
    },
    function (result) {
        console.error('Error', result.status);
    }
[...]

I’m using Chrome, and I dont know what else to do in order to fix this problem. I’ve even configured the server to accept headers from origin localhost.

188 thoughts on “Response to preflight request doesn't pass access control check”

  1. Pingback: viagra buy
  2. Pingback: cialis website
  3. Pingback: cialis for sale
  4. Pingback: viagra connect
  5. Pingback: viagra cialis
  6. Pingback: viagra coupon
  7. Pingback: viagra cheap
  8. Pingback: buy cialis online
  9. Pingback: cialis vs viagra
  10. Pingback: female viagra pill
  11. Pingback: sildenafil 50 mg
  12. Pingback: viagra substitute
  13. Pingback: lady viagra
  14. Pingback: viagra tablets uk
  15. Pingback: price for viagra
  16. Pingback: viagra dosage
  17. Pingback: viagra pfizer
  18. Pingback: viagra generic
  19. Pingback: generic viagra
  20. Pingback: buy viagra online
  21. Pingback: viagra price
  22. Pingback: viagra alternative
  23. Pingback: viagra pill

Leave a Comment