Register a new user in ejabberd using Erlang

2019-09-14 21:15发布

问题:

I am using erlang 17, ejabberd 14.07. I am trying to create chat application, For that I have to create user for ejabberd using Erlang. I have search but nothing found useful. There are three ways to do registration as far I have explored.

  1. Using command line
  2. From localhost
  3. Using other api

Is there any method in ejabberd which help me to register new user? I am new in Erlang and ejabberd so it becomes useful to me if you describe step if any configuration required.

回答1:

Do you mean that you want to call an Erlang function to create a user? You can use ejabberd_auth:try_register for that:

ejabberd_auth:try_register(<<"username">>, <<"example.com">>, <<"secret_password">>).