diff --git a/includes/api/class-wc-api-authentication.php b/includes/api/class-wc-api-authentication.php index d4878e8895a..d9553fa953e 100644 --- a/includes/api/class-wc-api-authentication.php +++ b/includes/api/class-wc-api-authentication.php @@ -41,10 +41,6 @@ class WC_API_Authentication { return new WP_User( 0 ); } - if ( '/reauth' === untrailingslashit( WC()->api->server->path ) ) { - $this->exit_with_unauthorized_headers(); - } - try { if ( is_ssl() ) { $keys = $this->perform_ssl_authentication(); @@ -114,8 +110,7 @@ class WC_API_Authentication { $auth_message = __( 'WooCommerce API. Use a consumer key in the username field and a consumer secret in the password field', 'woocommerce' ); header( 'WWW-Authenticate: Basic realm="' . $auth_message . '"' ); header( 'HTTP/1.0 401 Unauthorized' ); - esc_html_e( 'A valid consumer key and secret must be provided to access this resource', 'woocommerce' ); - exit; + throw new Exception( __( 'Consumer Secret is invalid', 'woocommerce' ), 401 ); } /**