Woocomerce API + Angularjs with Tokens

I am trying to connect to woocommerce api & angularjs, I already created the token through the woocommerce settings, and use angular “http get”. In the past i tried to send tokens through a header within the $http.get call but no luck either, Now i am getting the pre-flight error, any advice?

XMLHttpRequest cannot load http://example.com/blog/wc-api/v3/orders?consumer_key=ABC&consumer_secret=abc. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access. The response had HTTP status code 404.

In the controller:

var WooController = function($scope, $location, $http) {

  $http.get('http://example.com/blog/wc-api/v3/orders?consumer_key=ABC&consumer_secret=abc').
  success(function(res){
    $scope.posts = res;
});
};

Read more here: Woocomerce API + Angularjs with Tokens

Leave a Reply

Your email address will not be published. Required fields are marked *