Forum Documentation Showcase Pricing Learn more

Use REST API from a Site with HTTP Authentication (Password Protection)?

Hello there, I am building an app to grab data from a website running WooCommerce using the WooCommerce REST API.

I have successfully get data using HTTP Basic Auth by providing the consumer key as username and the consumer secret key as password. However, I would like to grab data from a staging website hosted by Siteground but ran into a 401 Unauthorized error.

According to Siteground support, this is because my staging website has password protection enabled using HTTP authentication. As in, visiting the website requires entering a username and password. They said I can resolve this by either disabling password protection on the website or configure the API to include the username and password.

To create an API on WooCommerce you just enter a name, assign a user, and choose its permission (read, write, or read/write). Not sure how I am supposed to modify it. Or can I configure the API connector to include those username and password?

Any insight would be appreciated. Thank you!

You can yes, but without knowing which parameters goes where, you are limited to trial and error (and there are endless combinations to how the formatting can look like). You need to ask them how the get call should be formatted, then it should be easy to replicate with bubble api connector.

Hi @simon7, thank you for pointing me in the right direction! Unfortunately Siteground support told me they can’t help me with that so I’ll have to figure this out myself. I’ll most likely disable the password protection for now.

Your welcome. Funny they cant help, they should know where the user/pass parameter goes.

Probably this won’t work, but in your browser try typing

If that works you have the params to do the api calls.

Didn’t work but I appreciate your help! They couldn’t help because it would be outside the scope of technical support. :stuck_out_tongue:

I’ll just disable password protection for now.