I have a JWT plugin for authentication but when I make call to /wp-json/jwt-auth/v1/token
it doesn't return anything, so I tried to return the response from rest_ensure_response function and it returned the response correctly. It was also the problem with other plugins also so I had to change all of those. Is there any way I can do this without having to change the plugin code?
Previously return statememnt (return blank)
return apply_filters('jwt_auth_token_before_dispatch', $data, $user);
Updated return statememnt (return correct response)
$return = apply_filters('jwt_auth_token_before_dispatch', $data, $user);
return rest_ensure_response($return);
Function Used
rest_ensure_response
Plugin URL https://github.com/Tmeister/wp-api-jwt-auth
WP_Error is also returning blank.
PS: I tested the plugin on a local installation of wordpress and it is working fine without changing anything. Now sure what is the issue. I have also turned off wp_debug.
In my code I was using rest_request_after_callbacks
filter so I have to edit the callback function. Now it is working fine.