Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to authenticate existing customer via WooCommerce rest API

I am creating a mobile app for a WooCommerce website and have gotten to a stage where I want the user to login or signup to the WooCommerce website before they continue with a purchase.

I can create a new customer no problem but I am having trouble when trying to authenticate an existing customer. After looking at the rest api docs for WooCommerce, I haven't come across any endpoint that will allow an existing user to log in to their account. Is there any endpoint that will allow me to do this that isn't documented?

like image 375
Win Avatar asked Sep 03 '17 10:09

Win


1 Answers

There might be other ways but what comes to my mind immediately is to use JWT Authentication for WP REST API plugin.

Using this plugin you can request for authentication on the server using the username and password. It will return a token if successful. Then use the token for checking if this user/customer is valid. If valid, use wc api to create an order for this customer.

like image 85
Reigel Avatar answered Oct 15 '22 23:10

Reigel