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 iOS绕地区网络检测
  • ¥15 python验证码滑块图像识别
  • ¥15 根据背景及设计要求撰写设计报告
  • ¥15 QT6颜色选择对话框显示不完整
  • ¥20 能提供一下思路或者代码吗
  • ¥15 用twincat控制!
  • ¥15 请问一下这个运行结果是怎么来的
  • ¥15 单通道放大电路的工作原理
  • ¥30 YOLO检测微调结果p为1
  • ¥15 DS18B20内部ADC模数转换器