字preSS JSON API和Ajax登陆 [英] wordpress json api and ajax login

查看:140
本文介绍了字preSS JSON API和Ajax登陆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我就一个字preSS主题基于AngularJS框架的工作,我已经安装WP REST API,它是从/ WP-json的访问,我的登录表单就是Ajax驱动(AngularJS控制器),现在我期待一种方式,以我的用户免受字preSS后端验证,我找遍了文档,它说cookie认证适用于这种情况。它也发送现时的每个参数的会谈,但对于如何从AJAX请求中首次验证发送用户名/密码,没有任何线索。难道JSON REST API支持发送用户名/密码?它似乎有它没有路线。

I am working on a wordpress theme based on AngularJS framework, I already setup WP REST API and it is accessible from the /wp-json, My login form is ajax driven (AngularJS controller) now I am looking for a way to authenticate my users against wordpress back-end, I searched all over docs, it says cookie authentication is applicable in this case. it also talks of sending "nonce" for each parameter but there is no clue on how to send username/password for first time authentication from within ajax request. Does json rest api support sending username/password ? it seems there is no routes to it.

我觉得我失去了一些东西基本/

I think i am missing something fundamental/

推荐答案

有三种认证方式是在这里是身份验证文件。

There are three types of authentication are the here is the document for the authentication.

http://wp-api.org/guides/authentication.html

您需要使用基本身份验证方法,那么字preSS将自动设置为登录用户的cookies和你不必管理最终cookie来登录。

You need to login using basic authentication method then wordpress will automatically set the cookies for the login user and you need not manage the cookie in your end.

PHP客户端 https://github.com/WP-API /客户端的PHP

JS客户端 https://github.com/WP-API /客户JS

这篇关于字preSS JSON API和Ajax登陆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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