WordPress at a glance
function is not described

WC_API_Authentication::exit_with_unauthorized_headers() private WC 2.4

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_API_Authentication{}

No Hooks.

Return

Null. Nothing.

Usage

// private - for code of main (parent) class only
$result = $this->exit_with_unauthorized_headers();

Changelog

Since 2.4 Introduced.

Code of WC_API_Authentication::exit_with_unauthorized_headers() WC 5.0.0

<?php
private function exit_with_unauthorized_headers() {
	$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' );
	throw new Exception( __( 'Consumer Secret is invalid.', 'woocommerce' ), 401 );
}