WC_API_Authentication::exit_with_unauthorized_headers()privateWC 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.

{} Это метод класса: WC_API_Authentication{}

Хуков нет.


null. Ничего.


// private - только в коде основоного (родительского) класса
$result = $this->exit_with_unauthorized_headers();

Список изменений

С версии 2.4 Введена.

Код WC_API_Authentication::exit_with_unauthorized_headers() WC 6.9.4

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 );