I am trying to authenticate as an AngularJS and Ionic App with Woocommerce API. Here is my code.
var ck = 'ck_6fffb5cbc00eqe00a7c3062cd85dae2ee64f919e';
var cs = 'cs_c2fd467cqq8857a08941c15bc708e3c16dc1f026';
var url = 'http://www.mysitecom/wc-api/v3';
var httpMethod = 'GET',
parameters = {
oauth_consumer_key : ck,
oauth_token : '370773112-GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb',
oauth_nonce : 'kYjzVBB8Y0ZFabxSWbWovY3uYSQ2pTgmZeNu2VS4cg',
oauth_timestamp : new Date().getTime(),
oauth_signature_method : 'HMAC-SHA1',
oauth_version : '1.0'//,
//file : 'vacation.jpg',
//size : 'original'
},
consumerSecret = cs,
tokenSecret = 'pfkkdhi9sl3r4s00';
var signature = oauthSignature.generate( httpMethod, url, parameters, cs, tokenSecret, { encodeSignature: true } );
console.log(signature);
$http.get(url+'/products?oauth_consumer_key='+ck+'&oauth_nonce='+parameters.oauth_nonce+'&oauth_signature='+signature+'&oauth_signature_method=HMAC-SHA1&oauth_timestamp='+parameters.oauth_timestamp+'&oauth_token='+parameters.oauth_token+'oauth_version=1.0').then(function(data){
console.log(data);
}, function(error){
console.log(error);
});
I am always getting the error .
PS: I am using this javascript library to generate the signature.
I did it. I was so close to doing it on the first day, somehow missed it.
Don't forget to implement the OAuth library here.