Closed mrmmg closed 3 years ago
I use this filter as follow:
add_filter( 'jwt_auth_whitelist', function ( $endpoints ) {
array_push($endpoints,'/wp-json/hm/v1/*');
return $endpoints;
});
@pesseba
i added this code to function.php (theme file) and it's not work.
code is:
add_filter( 'jwt_auth_whitelist', function ( $endpoints ) {
array_push($endpoints,'/wp-json/hm/v1/createUser');
return $endpoints;
});
and i tried this code:
function add_custom_route_to_jwt_auth($endpoints){
array_push($endpoints, '/wp-json/hm/v1/createUser');
return $endpoints;
}
add_filter( 'jwt_auth_whitelist' , 'add_custom_route_to_jwt_auth', 10, 1);
Hi @mrmmg , Maybe functions.php is not a good place to use rest api hooks. I'm not sure, but this is a template file, and rest api calls doesn't load template files, so wordpress could be skipping this. I think rest api is better extensible by plugins then themes...
so, you suggest me to make a plugin and handle all rest api token and jwt auth with a plugin. nice idea... I have to learn developing wordpress plugin
thanks you :)
On Tue, May 25, 2021, 22:55 pesseba @.***> wrote:
Hi @mrmmg https://github.com/mrmmg , Maybe functions.php is not a good place to use rest api hooks. I'm not sure, but this is a template file, and rest api calls doesn't load template files, so wordpress could be skipping this. I think rest api is better extensible by plugins then themes...
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/usefulteam/jwt-auth/issues/32#issuecomment-848108911, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHIT4BSVTFB7Q6OGKSRWONDTPPTQHANCNFSM45OUVYAA .
Hi
i have created a single file plugin and named it as jwt-auth-routes and upload it into plugins directory of wordpress and finally activate the plugin through wordpress admin panel but my custom routes returns 403 with message "JWT is not configurated properly."
my plugin information:
plugin file name:
jwt_auth_routes.php
code:
BUT IT's NOT WORKING. the other routes such as /token and /token/validate are working and the generated token is valid.
please help me.