WordPress at Your Fingertips
function is not described

WC_REST_Authentication::send_unauthorized_headers() public WC 1.0

If the consumer_key and consumer_secret $_GET parameters are NOT provided and the Basic auth headers are either not present or the consumer secret does not match the consumer key provided, then return the correct Basic headers and an error message.

{} It's a method of the class: WC_REST_Authentication{}

No Hooks.

Return

WP_REST_Response.

Usage

$WC_REST_Authentication = new WC_REST_Authentication();
$WC_REST_Authentication->send_unauthorized_headers( $response );
$response(WP_REST_Response) (required)
Current response being served.

Code of WC_REST_Authentication::send_unauthorized_headers() WC 5.9.0

public function send_unauthorized_headers( $response ) {
	if ( is_wp_error( $this->get_error() ) && 'basic_auth' === $this->auth_method ) {
		$auth_message = __( 'WooCommerce API. Use a consumer key in the username field and a consumer secret in the password field.', 'woocommerce' );
		$response->header( 'WWW-Authenticate', 'Basic realm="' . $auth_message . '"', true );
	}

	return $response;
}