curl - Trying to register user, ejabberd returns "401 Unauthorized" -


i want register user in ejabberd using admin rest api. "401 unauthorized" when try run following curl command.

curl -v -x post -h "x-admin: true" -h "authorization: bearer c3ojg78iuljj7o90wm3jhirxonw9bplp" http://xxx.xxx.x.xx:5280/api/register -d '{"user": "new","host": "xxx.xxx.x.xx","password": "new"}' 

i not sure missing.

is there specific scope need authorized on, register user? also, add user shared_roster after registering them. please let me know if there specific scope need use adding user shared_roster well.

can please me out? thanks.

edit: in ejabberd.log, see

2016-07-21 21:51:44.366 [info] <0.533.0>@mod_http_api:log:437 api call register [{<<"user">>,<<"newuser">>},{<<"host">>,<<"xxx.xxx.xxx.xxx">>},{<<"password">>,<<"newuser">>}] xxx.xxx.xxx.xxx:39527 

but no new user created!

edit: below have in "access" section of ejabberd.yml file

access:    register:     all: allow 

btw using ejabberd 16.03


Comments