FAQ How to trigger authentication for custom URL
June 29, 2024 at 4:56 AMHow do I trigger NADI for a custom login page?
By default, NADI does only trigger the login method if you requesting /wp-admin. The option Enable login using a custom login page adds /login to this list.
Triggering the authentication for a completely different URL can be achieved by using the next_ad_int_auth_enable_login_check hook:
For example, if you want to authenticate the endpoint /wp-json/jwt-auth/v1/token
of the wp-api-jwt-auth plug-in, you can create your own filter:
add_filter(NEXT_AD_INT_PREFIX . 'auth_enable_login_check', function ($loginCheckAlreadyEnabled) {
if (!$loginCheckAlreadyEnabled) {
$loginCheckAlreadyEnabled = in_array(strtok($_SERVER["REQUEST_URI"],'?'), array (
"/wp-json/jwt-auth/v1/token" ,
"/wp-json/jwt-auth/v1/token/validate",
));
}
return $loginCheckAlreadyEnabled;
}, 10, 1);