$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>rest api - How can I authenticate user credentials against a Wordpress instance?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

rest api - How can I authenticate user credentials against a Wordpress instance?

matteradmin8PV0评论

I am running a second web application in addition to Wordpress/WooCommerce. When users log into the second application, I'd like to authenticate them against the WP instance. I am using the REST API for data queries, but that only allows authentication with a consumer key. The API doesn't provide endpoints for user authentication.

Given a username and password, how can I authenticate against a Wordpress/WooCommerce instance? (In other words, from outside the instance.)

I am running a second web application in addition to Wordpress/WooCommerce. When users log into the second application, I'd like to authenticate them against the WP instance. I am using the REST API for data queries, but that only allows authentication with a consumer key. The API doesn't provide endpoints for user authentication.

Given a username and password, how can I authenticate against a Wordpress/WooCommerce instance? (In other words, from outside the instance.)

Share Improve this question edited Oct 25, 2017 at 16:46 lofidevops asked Oct 24, 2017 at 21:34 lofidevopslofidevops 4255 silver badges13 bronze badges 2
  • Have you looked at the wp_authenticate hook? codex.wordpress/Plugin_API/Action_Reference/wp_authenticate – LPH Commented Oct 25, 2017 at 3:50
  • @LPH I assume that is only useful within a running instance? I'm looking to authenticate from outside the instance / against the instance (I've update question to clarify) – lofidevops Commented Oct 25, 2017 at 8:52
Add a comment  | 

1 Answer 1

Reset to default 0

The JWT Authentication for WP REST API plugin offers a user authentication mechanism. You will need to:

  • install and configure the plugin
  • make user authentication requests against the new token endpoint
    • optionally use the token to make further queries on behalf of users
    • continue using OAuth 1.0 for WP/WC REST queries

References:

  • https://jwt.io/introduction/
  • Using JWT to authenticate a user with an external system?
  • JWT authentication with WP - Approach
Post a comment

comment list (0)

  1. No comments so far