尝试创建 Quickblox 群聊对话框,使用 REST API 登录用户时出现错误. [英] Trying to create a Quickblox group chat dialog, get Error when using REST API to login user.

查看:80
本文介绍了尝试创建 Quickblox 群聊对话框,使用 REST API 登录用户时出现错误.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试完全通过 REST API 在 quickblox 中创建群聊对话框.如何通过 REST API 创建用户、会话、登录,然后创建聊天对话框?我只能成功做到前两个.

I'm attempting to create a group chat dialog in quickblox entirely through the REST API. How to create a user, a session, login, and then create a chat dialog all from the REST API? I can only successfully do the first two.

本教程有示例:http://quickblox.com/developers/Authentication_and_Authorization#API_User_Sign_In

我能够创建一个会话并创建一个用户,之后我无法做更多的事情.当我尝试登录用户时,如上例所示,使用教程中的这个和我的令牌和用户:

I am able to create a session and create a user, after that I can't do more. When I try to login a user, as the example above, using this from the tutorial with my token and user:

curl -X POST \
 -H "Content-Type: application/json"\
 -H "QuickBlox-REST-API-Version: 0.1.0" \
 -H "QB-Token: bee57951d76c03ffdecaad65bba039f4ad413ed7" \
 -d '{"login": "Laralara", "password": "12345678"}' \
 http://api.quickblox.com/login.json

我收到错误:

 curl: (6) Could not resolve host: QuickBlox-REST-API-Version
 {"errors":{"login":["(or email) cannot be blank"],"password":["cannot be blank"]}}

无论我在数据-d"中输入什么,我都会得到相同的响应.

No matter what I put in the data "-d" I get the same response.

如果我尝试像示例中那样直接创建聊天对话框:http://quickblox.com/developers/Chat#Create_dialog

If I try to create a chat dialog directly like in the example using this: http://quickblox.com/developers/Chat#Create_dialog

curl -X POST \
 -H "Content-Type: application/json"\
 -H "QuickBlox-REST-API-Version: 0.1.0" \
 -H "QB-Token: ffed2e8da05b7a858ddee861ff31a09886aef540" \
 -d '{"type": 2, "name": "Chat Bob, Sam, Garry", "id": "17435", "occupants_ids": "5712780"}' \
 http://api.quickblox.com/chat/Dialog.json

我收到错误:

curl: (6) Could not resolve host: QuickBlox-REST-API-Version
{"errors":{"base":["Forbidden. Need user."]}}

谢谢.

推荐答案

您的字段 loginpassword 是错误的.您应该使用 user[login]user[password].

Your fields login and password are wrong. You should use user[login]and user[password].

看看 Quickblox 文档中的这个例子:https://quickblox.com/developers/Generate_session_in_PHP

Take a look at this example in the Quickblox documentation: https://quickblox.com/developers/Generate_session_in_PHP

这篇关于尝试创建 Quickblox 群聊对话框,使用 REST API 登录用户时出现错误.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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