如何通过 WooCommerce rest API 对现有客户进行身份验证 [英] How to authenticate existing customer via WooCommerce rest API

查看:52
本文介绍了如何通过 WooCommerce rest API 对现有客户进行身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为 WooCommerce 网站创建一个移动应用程序,并且已经到了一个阶段,我希望用户在继续购买之前登录或注册 WooCommerce 网站.

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.

我可以毫无问题地创建新客户,但在尝试对现有客户进行身份验证时遇到问题.在查看了 WooCommerce 的其余 api 文档后,我还没有遇到任何允许现有用户登录其帐户的端点.是否有任何端点允许我执行此操作但未记录在案?

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?

推荐答案

可能还有其他方法,但我立即想到的是使用 WP REST API 的 JWT 身份验证 插件.

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

使用此插件,您可以使用用户名和密码在服务器上请求身份验证.如果成功,它将返回一个令牌.然后使用令牌检查此用户/客户是否有效.如果有效,请使用 wc api 为该客户创建订单.

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.

这篇关于如何通过 WooCommerce rest API 对现有客户进行身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆