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
1 Answer
Reset to default 0The 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