-
Notifications
You must be signed in to change notification settings - Fork 23
Description
I have a new custom route which I created via register custom route which I need to secure. If I provide a validate callback which returns true always and forever, the call will succeed without a header sent. If I send an Authorization with valid token, it always fails.
{
"code": "jwt_auth_invalid_token",
"message": "Signature verification failed",
"data": {
"status": 403
}
}
====> here is the register rest route
register_rest_route( 'parent-checklist-rest/v2', '/registration', array( 'methods' => 'GET, POST', 'callback' => __NAMESPACE__.'\\register_user', 'validate_callback'=> __NAMESPACE__.'\\check_JWT', ) );
====> validation callback
`function check_JWT(\WP_REST_Request $request){
//$header = $request->get_header('Authorization');
return TRUE;
//$response = wp_remote_post($header)
}`
Expected Behavior ==>
- send valid token in Authorization Header
- retrieve token in my validation callback
- post token to /wp-json/simple-jwt-authentication/v1/token/validate
- allow the call if token is valid
- call fails is no auth header is sent
- call fails if token is invalid
Actual Behavior ==>
- the call fails even with valid token
- the call succeeds as long as no Authorization Header is provided
- seems my validate callback is not in play