WordPress at a glance
function is not described

rest_authorization_required_code() WP 4.7.0

Returns a contextual HTTP error code for authorization failure.

No Hooks.

Return

Int. 401 if the user is not logged in, 403 if the user is logged in.

Usage

rest_authorization_required_code();

Code of rest authorization required code: wp-includes/rest-api.php VER 5.1.1

<?php
function rest_authorization_required_code() {
	return is_user_logged_in() ? 403 : 401;
}