jadahl / mod_restful

RESTful interface to ejabberd
84 stars 34 forks source link

401 Unauthorized #33

Closed phoenix377 closed 7 years ago

phoenix377 commented 8 years ago

I've installed ejabberd 2.1.11. To build module, I used ejabberd 2.1.11 source code and 0.1.x branch. And I've done all settings as same as in ReadMe. But when I send request to mod_restful_register, I got 401 error. The followings are my configuration. {{8088,{0,0,0,0}}, ejabberd_http, [ {request_handlers, [ {["api"], mod_restful} ]} ]}

{mod_restful, [ {api, [ {["admin"], mod_restful_admin, [ {key, "secret"}, {allowed_commands, [register, unregister]} ]}, {["register"], mod_restful_register, [{key, "secret"}]} ]} And here is the post request I sent. URL: http://messaging.goldenspear.com:8088/api/register/register params: { "key": "secret", "username": "newuser", "host": "localhost", "password": "newuser" } But it returns 401 Unauthorized error. Also Get request is_registered returns 401 error. Please let me know what I've done wrong.

SabrinaMadX commented 7 years ago

shouldn't the register endpoint be http://messaging.goldenspear.com:8088/api/register in your case?

phoenix377 commented 7 years ago

It was not a problem with mod_restful. There was a problem with NGINX itself.