WordPress / application-passwords

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

401 error from AngularjS app

chadlamson opened this issue · comments

I have created an app password, and following the plugin instructions, created the base64 encoded string, but I am getting a 401 Unauthorized when trying to make a POST request.

I have edited my .htaccess file to have RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}], but still not working. Here is a sample of my request:


$http.post('http://mysite.com/wp-json/wp/v2/orders', {
        headers: {'Authorization': 'Basic PW_HERE'}
      },
      {
        'title':$scope.userName,
        'status':'publish',
        'fields': {
            'customer_name': $scope.userName,
            'customer_email_address': $scope.userEmail,
            'customer_phone_number': $scope.userPhone,
            'customer_zipcode': $scope.userZip
        }
      });

are you sure you're using the right path? orders sounds like a woocommerce endpoint, and I think they use the wc prefix.