尝试获取 ejabberd 的 oauth 令牌时获取 'access_denied',调用 REST API
Getting 'access_denied' when trying to get oauth token for ejabberd, to call REST API
我的主要目的是保存用户,shared_rosters,将用户添加到 shared_rosters 等等...从我的网站。我在后端使用 NodeJS。
我真的找不到任何库来完成上述任务,因此我决定将 REST API 与 JSON 一起使用,可用于 ejabberd(请分享任何可以完成上述任务的库提到的任务)。为此,我正在尝试通过 ejabberd 的 oauth 获取访问令牌。我已按照 ejabberd 文档中提到的步骤进行操作。
我已将以下内容添加到我的 'ejabberd.yml' 文件中。
-
port: 5280
module: ejabberd_http
request_handlers:
"/websocket": ejabberd_http_ws
"/log": mod_log_http
# OAuth support:
"/oauth": ejabberd_oauth
# ReST API:
"/api": mod_http_api
web_admin: true
http_bind: true
captcha: true
还在 yml 文件中添加了 oauth 特定参数。
commands_admin_access: configure
commands:
- add_commands: user
oauth_expire: 3600
oauth_access: all
我不确定oauth参数的放置是否很重要。我不确定把它放在哪里,所以我把它放在下一行上面。我在其他页面上看到了这个展示位置。
### DATABASE SETUP
重新启动 Ejabberd。
当我转到以下 URL 时,我得到了预期的页面
http://example.net:5280/oauth/authorization_token?response_type=token&client_id=Client1&redirect_uri=http://client.uri&scope=get_roster+sasl_auth
现在,当我输入管理员的用户名和密码时,如下所示
User: admin@xxx.xxx.x.xxx
Server: xxx.xxx.x.xxx
Password: admin
我收到的回复是
error=access_denied
我不确定我错过了什么。有人可以帮我吗?
实际上,当我输入数据时,我也在做同样的事情
User: admin
Server: xxx.xxx.x.xxx
Password: admin
我拿到了令牌。
我的主要目的是保存用户,shared_rosters,将用户添加到 shared_rosters 等等...从我的网站。我在后端使用 NodeJS。
我真的找不到任何库来完成上述任务,因此我决定将 REST API 与 JSON 一起使用,可用于 ejabberd(请分享任何可以完成上述任务的库提到的任务)。为此,我正在尝试通过 ejabberd 的 oauth 获取访问令牌。我已按照 ejabberd 文档中提到的步骤进行操作。
我已将以下内容添加到我的 'ejabberd.yml' 文件中。
-
port: 5280
module: ejabberd_http
request_handlers:
"/websocket": ejabberd_http_ws
"/log": mod_log_http
# OAuth support:
"/oauth": ejabberd_oauth
# ReST API:
"/api": mod_http_api
web_admin: true
http_bind: true
captcha: true
还在 yml 文件中添加了 oauth 特定参数。
commands_admin_access: configure
commands:
- add_commands: user
oauth_expire: 3600
oauth_access: all
我不确定oauth参数的放置是否很重要。我不确定把它放在哪里,所以我把它放在下一行上面。我在其他页面上看到了这个展示位置。
### DATABASE SETUP
重新启动 Ejabberd。
当我转到以下 URL 时,我得到了预期的页面
http://example.net:5280/oauth/authorization_token?response_type=token&client_id=Client1&redirect_uri=http://client.uri&scope=get_roster+sasl_auth
现在,当我输入管理员的用户名和密码时,如下所示
User: admin@xxx.xxx.x.xxx
Server: xxx.xxx.x.xxx
Password: admin
我收到的回复是
error=access_denied
我不确定我错过了什么。有人可以帮我吗?
实际上,当我输入数据时,我也在做同样的事情
User: admin
Server: xxx.xxx.x.xxx
Password: admin
我拿到了令牌。