If a user is logged it, the filter function require_auth_for_all_endpoints
isn’t returning the $result
.
if ( ! is_user_logged_in() ) {
// code
}
return $result;
]]>
In the faq I’m trying to follow the suggestion in “How do I whitelist other REST API endpoint? (via filter hook)”.
I see a call to add_filter
where should I place this? in functions.php?
Is allow_my_endpoints
defined somewhere?
And the anonymous function
function ($allowed_endpoints ) {
$allowed_endpoints[] = '/my-endpoint';
return $allowed_endpoints;
};
how should this interact with the filter hook?
(also the example seems to be invalid php, the anonymous function lacks a trailing semicolon, small things like this set beginners back a lot of time.)
]]>Ajax request uses OPTIONS request as “preflight”, but it’s being blocked for unauthorized access and the actual call with post or get that is hold the authorization Bearer + token is not done.
Is there a solution for this?
]]>hi, i get token and use “Bearer “+ token as Autorization Header for calling not whitelist apis.
althoght validate token returns:
{
“code”: “jwt_auth_valid_token”,
“data”: {
“status”: 200
}
}
but when i call any api it always returns :
{
“code”: “rest_not_logged_in”,
“message”: “You are not currently logged in.”,
“data”: {
“status”: 401
}
}
whats the problem?
]]>