WordFence 2FA and JWT Tokens Plugins
-
I created some custom REST API endpoints on a WordPress website to deliver data that should not be public, so I set them to require an authenticated user. At the same time, I installed and activated the JWT Authentication for WP REST API plugin, allowing the application accessing these endpoints to use JWT tokens. The problem was my user having 2FA enabled (this website uses WordFence 2FA feature), which blocked the token generation request. WordFence has a setting to ignore the use of 2FA in XML-RPC requests, but not for the REST API, so I had to add three lines of code to modules/login-security/classes/controller/wordfencels.php, starting at line 556:
if (defined(‘REST_REQUEST’) && REST_REQUEST) {
return $user;
}It would be helpful to have a similar setting for the REST API as the one available for XML-RPC.
The page I need help with: [log in to see the link]
- You must be logged in to reply to this topic.