duandeng2265 2017-02-28 11:46
浏览 46
已采纳

从移动应用程序与Wordpress网站API进行交互

I am developing an app that is presented with a login screen containing the usual username and password text inputs.

When pressing the Login button the code is supposed to make a HTTP Web Request to the Wordpress website as an attempt to log in.

I have had a look at the WP plugins called JSON API and JSON API USER but the documentation is very limited.

How would I go about to properly log in to the Wordpress website as well as retrieving user information from databases?

NOTE: I'm developing in Xamarin but any code examples from any language is fine, as I could easily port the code.

  • 写回答

1条回答 默认 最新

  • dpw30157 2017-03-01 09:37
    关注

    To connect to the Wordpress website's system and interact with it, you need to indeed make a few API calls.

    Using the plugins JSON API and JSON API USER is the easiest way to do so.

    1. Install JSON API and JSON API USER plugins from the website control panel
    2. Make a Web Requests, one after another, to get nonce and get authorization cookie using the the following calls:

    Nonce: http://www.mywordpresswebsite.com/api/get_nonce/?controller=user&method=generate_auth_cookie&insecure=cool

    and

    Auth Cookie: http://www.mywordpresswebsite.com/api/user/generate_auth_cookie/?username=USERNAME_HERE&password=PASSWORD_HERE&insecure=cool

    NOTE:

    At the end of the requests you can see the parameter insecure=cool.

    This is used for unsecured communication.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容