How to authenticate existing customer via WooCommerce rest API

余生颓废 提交于 2019-11-27 03:40:31

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/46022349/how-to-authenticate-existing-customer-via-woocommerce-rest-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!