1

I have tried building a ionic 4 app using woo-commerce rest API. But the problem is i am not able to POST a customer or add a customer . I am perfectly getting the data but not able to post. I have generated the API by giving permission of read and write . but i am getting 401 unauthorised error.

sideshowbarker
  • 81,827
  • 26
  • 193
  • 197
  • you have to check your header & body if you are sending anything if they are correct the error indicates its hitting the server but not authorizing your request can you send me the URL ,header ,body what you sending – Abhijit Chakra Jul 06 '19 at 06:42

1 Answers1

0

try with this one

wc : any = WC({

    url:"https://www.xxxxxx.com",
    consumerKey:"ck_xxxxxxx...................xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    consumerSecret:"cs_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    wpAPI : true,
    version:"wc/v2",
    queryStringAuth: true // Force Basic Authentication as query string true and using under HTTPS

});
Chanaka Weerasinghe
  • 5,404
  • 2
  • 26
  • 39