What will make Woocommerce REST API to issue 401 [closed]

I took a lot of time – the whole night – trying to fix this “401: Sorry, you cannot list resources.” The solutions shared by many online are great although they did not work as stated for me. In my case, running my own VPS server, what worked for me was going to WHM then under Service Configuration clicking Apache Configuration. In the “Include Editor:” in the “Pre Main Include”, I selected “All Versions” and pasted this from this link https://robotninja.com/blog/fix-common-woocommerce-rest-api-issues/

SetEnvIf Authorization “(.*)” HTTP_AUTHORIZATION=$1

On update it will ask to restart Apache. Restart and test your API – it should work. If you receive a 500 Internal Error, simply deactivate and reactivate woo-commerce plugin in the plugins section of WordPress.

Hope this helps someone and saves them hours of frustrations.

Edit… had to refer to this after i reset my configurations. In this line: SetEnvIf Authorization “(.*)” HTTP_AUTHORIZATION=$1 replace the double quotes and use the standard quotes because the above are pasted from Microsoft Word and are not the right kind of quote. Use this instead.

SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

Hope this helps anyone who may stumble upon this issue