0

Can some please explain me how to configure ejabberd rest api support, I could not find any sufficient resource regarding this.

I'm using linux (kubuntu 16.04), so till now I've done sudo apt-get install ejabberd and please tell me is there any need of /etc/ejabberd/ejabberd.cfg or all the config is done in /etc/ejabberd/ejabberd.yml file.

Ankit
  • 326
  • 1
  • 7
  • 18

1 Answers1

1

All configuration is done in ejabberd.yml. The documentation for oauth and ReST API is here: ejabberd OAuth Support

Mickaël Rémond
  • 9,035
  • 1
  • 24
  • 44
  • Can you please tell me the exact configuration required to be done in ejabberd.yml file to use mod_rest – Ankit Jul 20 '16 at 07:52
  • mod_rest is a contribution but we do not use it as ejabberd now includes ReST API using OAuth. The link I provided is now the reference for ejabberd official module. – Mickaël Rémond Jul 20 '16 at 11:10
  • Will it work in ejabberd version 16.01, as I'm using version 16.01 – Ankit Jul 20 '16 at 11:15
  • well, I tried as given in the doc, but when I entered the user, server and password at https://localhost:5280/oauth/authorization_token?response_type=token&client_id=Client1&redirect_uri=https://localhost:5280&scope=get_roster+sasl_auth url, I received no token – Ankit Jul 20 '16 at 11:34
  • Instead I received following error 2016-07-20 17:06:01.285 [error] <0.1021.0> CRASH REPORT Process <0.1021.0> with 0 neighbours crashed with reason: call to undefined function oauth2:authorize_password({<<"ankit">>,<<"localhost">>}, <<"Client1">>, <<"https://localhost:5280">>, [<<"get_roster">>,<<"sasl_auth">>], {password,<<"12345">>}) – Ankit Jul 20 '16 at 11:37
  • 1
    Probably wrongly installed. You are missing modules. – Mickaël Rémond Jul 20 '16 at 14:25
  • ok I reinstalled ejabberd, now I'm using version 16.06, also I'm able to get the token but when I use that token using command `curl -X GET -H "X-Admin: true" -H "Authorization: Bearer dr78JYZBTE570D99kSSL7A8Fn13xgAIE" http://localhost:5280/api/connected_users`, I get `"401 Unauthorized"` – Ankit Jul 20 '16 at 18:11
  • Hi. I also get the same error when using the token. How did you solve the error? – Hasan Hashem Jan 14 '17 at 17:25