You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 14, 2022. It is now read-only.
Just worth noting that on the core proposal, the wp_is_application_passwords_available filter is available -- it isn't itself specific to endpoints, as the authentication mechanism can also work with xmlrpc requests and is more agnostic than specific to a specific api implementation, but an earlier action could check the path and disable it if desired.
Here's what I came up with to bypass application passwords on a specific endpoint to allow for custom authentication.
function bypass_application_passwords_for_webhook ($available) {
// if we can't get the current request URL, return default
global $wp;
if ( ! is_object ($wp) || empty ($wp->request)) {
return $available;
}
// the path of the current request
$current_path = trim ($wp->request, '/');
// the webhook path (which we want to bypass application passwords)
$webhook_url = \rest_url (REST_NAMESPACE . REST_ROUTE);
$webhook_path = trim (parse_url ($webhook_url, PHP_URL_PATH), '/');
// if the current path is the webhook path, bypass application password authentication
if ($current_path == $webhook_path) {
return false;
}
return $available;
}
add_filter ('wp_is_application_passwords_available', 'bypass_application_passwords_for_webhook');
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
See https://wordpress.org/support/topic/limit-application-to-specific-rest-endpoints/
The text was updated successfully, but these errors were encountered: