I have this function which register new endpoint. By default the end point is public. I'm using Application Passwords' plugin which create a basic authentication account, let's say Basic 64basePassword
add_action( 'rest_api_init', function () {
register_rest_route( 'wp/v2', 'somthing', array(
'methods' => 'GET',
'callback' => 'callback_function',
));
});
There is argument named permission_callback, but this use cookies.
Can I use permission_callback or anything else to hiding the endpoint so only requests with basic authentication can access the endpoint?
Or let me ask: Using basic authentication in headers, let's say 'Authorization: Basic some64basePass'
How I can check the value of Authorization in the header is valid or not?