Filter
rp_api_not_valid_error_message
On this page
Filters the error message returned when a REST API token fails validation.
Used in the JWT verifier for several failure cases: the token cannot be decoded (the message is the translated exception text), the decoded data has no user, the private key is invalid, the token or public key has expired, or the user is not valid. The message is returned in a rest_forbidden WP_Error.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$message | string | The error message for the specific failure. |
Return value#
string. The error message.
Example#
function my_token_invalid_message( $message ) {
return __( 'Your session is no longer valid. Please sign in again.', 'my-textdomain' );
}
add_filter( 'rp_api_not_valid_error_message', 'my_token_invalid_message' );
Source#
Applied in:
includes/rest-api/Utilities/RP_JWT_Verifier.php(line 70), inRP_JWT_Verifier::jwt_verify()includes/rest-api/Utilities/RP_JWT_Verifier.php(line 95), inRP_JWT_Verifier::checking_decoded_data()includes/rest-api/Utilities/RP_JWT_Verifier.php(line 120), inRP_JWT_Verifier::checking_user_id()includes/rest-api/Utilities/RP_JWT_Verifier.php(line 127), inRP_JWT_Verifier::checking_user_id()includes/rest-api/Utilities/RP_JWT_Verifier.php(line 148), inRP_JWT_Verifier::checking_user()
See also#
Was this page helpful?
