【发布时间】:2018-09-16 10:39:48
【问题描述】:
请解释一下如何配置 ejabberd rest api 支持,我找不到任何足够的资源。
我使用的是 linux (ubuntu 16.04),所以到目前为止我已经完成了 apt-get -y install ejabberd,请告诉我是否需要更改配置文件 /etc/ejabberd/ejabberd.yml 文件。
<pre>
listen:
## To handle ejabberd commands using XML-RPC
-
port: 4560
module: ejabberd_xmlrpc
access_commands: {}
-
port: 5280
## ip: "::"
ip: "0.0.0.0"
module: ejabberd_http
request_handlers:
"/websocket": ejabberd_http_ws
# OAuth support:
"/oauth": ejabberd_oauth
# ReST API:
"/api": mod_http_api
## "/pub/archive": mod_http_fileserver
web_admin: true
http_bind: true
register: true
captcha: true
tls: false
certfile: "/etc/ejabberd/ejabberd.pem"
# Allow OAuth authentication and token generation
commands_admin_access: configure
commands:
- add_commands: [user, admin, open]
# Tokens are valid for a year as default:
oauth_expire: 31536000
oauth_access: all
api_permissions:
- "admin access":
- who:
- admin
- what:
- "*"
- "!stop"
</pre>
好吧,我按照文档中的说明进行了尝试,但是当我在以下位置输入用户、服务器和密码时 http://ipaddress:5280/oauth/authorization_token?response_type=token&client_id=localhost&redirect_uri=http://www.razrcorp.com/&scope=get_roster+sasl_auth
我可以看到授权请求应用程序本地主机想要访问范围 get_roster sasl_auth
但是当我从用户填写时 - test@localhost 服务器 - ipaddress 密码 - 测试
它重定向到 http://ipaddress:5280/oauth/authorization_token 并响应 此页面无法使用 ipaddress 没有发送任何数据。 ERR_EMPTY_RESPONSE
如果检查它说的日志
2018-04-06 11:33:49.136 [错误] 崩溃报告进程 有 0 个邻居崩溃,原因是:调用未定义函数 oauth2:authorize_password({>,>}, >, http://www.razrcorp.com/">>, [>,> ], {密码,>})
【问题讨论】: