Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • So, for anyone else who stumbles across this post experiencing similar results:

    I dug through the source code a little (both the plugin and core) to get a better understanding of how to use this with custom endpoints. There’s good news and bad news.

    The good news is that this plugin can definitely be used with your custom endpoints. The bad news is that it’s convoluted as all get out; at least it has been for me up until the time of writing this.

    Long story short:

    Make sure you’re registering your REST endpoints using an action hook on rest_api_init. I created a custom wrapper function to retrieve the current user (wp_get_current_user()), which checks the returned WP_User instance’s ID property. If it’s 0, then I directly invoke the Application_Passwords::fallback_populate_username_password() method and call the user retrieval function again. If the authorization header is populated with a legitimate user:pass base64 encoded pair, then you should get back the corresponding user for that WP_User instance. Even then, it only seems to work with an account with elevated privileges. I tried using this with an account with a specific custom role, to no avail.

    If anyone cares to chime in and offer a better way of achieving the desired result, please do. Because, I have either a plugin and/or configuration setting that is tripping up the precedence of this plugin’s registered actions/filters to facilitate all of the proper authentication.

    This could also be due to me registering these endpoints outside of a plugin, from my functions.php file. But, I haven’t gotten that far, yet. This works for what I need.

    • This reply was modified 6 years, 6 months ago by Erutan409. Reason: syntax highlihting

    I’m also having the same issue. I’m pretty stoked to give this plugin a try. I’m hoping it makes a huge [positive] impact on performance.

Viewing 2 replies - 1 through 2 (of 2 total)