Skip to content
Docs
Get RestroPress

Filter

rp_api_token_not_found_error_message

Updated
On this page

Filters the error message returned when the token or API key is missing from the request.

Used in the JWT verifier when the Authorization header does not contain a token in the expected form or the API key header is missing. The message is returned in a rest_forbidden WP_Error.

Parameters#

ParameterTypeDescription
$messagestringDefault message, 'Token OR API key not found in request!!!'.

Return value#

string. The error message.

Example#

function my_token_not_found_message( $message ) {
	return __( 'Missing credentials.', 'my-textdomain' );
}
add_filter( 'rp_api_token_not_found_error_message', 'my_token_not_found_message' );

Source#

Applied in:

  • includes/rest-api/Utilities/RP_JWT_Verifier.php (line 77), in RP_JWT_Verifier::jwt_verify()

See also#

Was this page helpful?