From 9d070851a633d4a7bc6fb43ec591beb5a87bc37e Mon Sep 17 00:00:00 2001 From: Nico Martin Date: Sun, 20 Apr 2025 17:58:21 +0200 Subject: [PATCH 1/3] no error if jwt_auth_invalid_token --- public/class-jwt-auth-public.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/class-jwt-auth-public.php b/public/class-jwt-auth-public.php index eca85ca..1f85607 100644 --- a/public/class-jwt-auth-public.php +++ b/public/class-jwt-auth-public.php @@ -261,8 +261,8 @@ public function determine_current_user( $user ) { $token = $this->validate_token( new WP_REST_Request(), $auth_header ); if ( is_wp_error( $token ) ) { - if ( $token->get_error_code() != 'jwt_auth_no_auth_header' ) { - /** If there is an error, store it to show it after see rest_pre_dispatch */ + if ($token->get_error_code() != 'jwt_auth_no_auth_header' && $token->get_error_code() != 'jwt_auth_invalid_token') { + /** If there is an error, store it to show it after see rest_pre_dispatch */ $this->jwt_error = $token; } From ec85ed862292af3439e3b7063dcb196822d5894a Mon Sep 17 00:00:00 2001 From: Nico Martin Date: Sun, 20 Apr 2025 18:01:20 +0200 Subject: [PATCH 2/3] spaces to tab --- public/class-jwt-auth-public.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/class-jwt-auth-public.php b/public/class-jwt-auth-public.php index 1f85607..0faf8fd 100644 --- a/public/class-jwt-auth-public.php +++ b/public/class-jwt-auth-public.php @@ -261,8 +261,8 @@ public function determine_current_user( $user ) { $token = $this->validate_token( new WP_REST_Request(), $auth_header ); if ( is_wp_error( $token ) ) { - if ($token->get_error_code() != 'jwt_auth_no_auth_header' && $token->get_error_code() != 'jwt_auth_invalid_token') { - /** If there is an error, store it to show it after see rest_pre_dispatch */ + if ($token->get_error_code() != 'jwt_auth_no_auth_header' && $token->get_error_code() != 'jwt_auth_invalid_token') { + /** If there is an error, store it to show it after see rest_pre_dispatch */ $this->jwt_error = $token; } From 8a8bcb0ad1c62b038aecc96ccafbc051f10e8059 Mon Sep 17 00:00:00 2001 From: Nico Martin Date: Sun, 20 Apr 2025 18:01:52 +0200 Subject: [PATCH 3/3] spaces to tab --- public/class-jwt-auth-public.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/class-jwt-auth-public.php b/public/class-jwt-auth-public.php index 0faf8fd..daf03ea 100644 --- a/public/class-jwt-auth-public.php +++ b/public/class-jwt-auth-public.php @@ -261,7 +261,7 @@ public function determine_current_user( $user ) { $token = $this->validate_token( new WP_REST_Request(), $auth_header ); if ( is_wp_error( $token ) ) { - if ($token->get_error_code() != 'jwt_auth_no_auth_header' && $token->get_error_code() != 'jwt_auth_invalid_token') { + if ( $token->get_error_code() != 'jwt_auth_no_auth_header' && $token->get_error_code() != 'jwt_auth_invalid_token' ) { /** If there is an error, store it to show it after see rest_pre_dispatch */ $this->jwt_error = $token; }