But this doesn't work as expected. Instead, I found in /var/log/apache2/error.log:
[Mon Apr 15 11:42:07.347592 2019] [php7:error] [pid 31616] [...] PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function mod_jwt_auth_token_before_dispatch(), 1 passed in /var/www/.../wp-includes/class-wp-hook.php on line 288 and exactly 2 expected in /var/www/.../hooks.php:54\nStack trace:\n#0 /var/www/.../wp-includes/class-wp-hook.php(288):
mod_jwt_auth_token_before_dispatch(Array)\n#1 /var/www/.../wp-includes/plugin.php(208):
WP_Hook->apply_filters(Array, Array)\n#2 /var/www/.../wp-content/plugins/jwt-authentication-for-wp-rest-api/public/class-jwt-auth-public.php(165):
apply_filters('jwt_auth_token_...', Array, Object(WP_User))\n#3 /var/www/.../wp-includes/rest-api/class-wp-rest-server.php(946):
Jwt_Auth_Public->generate_token(Object(WP_REST_Request))\n#4 /var/www/.../wp-includes/rest-api/class-wp-rest-server.php(329): WP_REST_Server->dispatch(Object(WP_RE in /var/www/.../hooks.php on line 54, referer: http://localhost:3000/login
Does anyone have a clue what might be causing this?
I am trying to fire
wp_login
action withjwt_auth_token_before_dispatch
filter. The code I am using is something like this:Although the doc specifies
$data
as the only argument, I see from the source code that the filter can accept two parameters: https://github.com/Tmeister/wp-api-jwt-auth/blob/a67b833992ab82c2b8fe29210a9bad03623b5045/public/class-jwt-auth-public.php#L165But this doesn't work as expected. Instead, I found in
/var/log/apache2/error.log
:Does anyone have a clue what might be causing this?