Creating new user with Smack on ejabberd throws XMPP Exception: forbidden(403)

前端 未结 4 1049
感动是毒
感动是毒 2021-01-05 11:10

Hi I am working on ejabberd and I am quite new to this technology.

I am trying to add a user on my ejabberd server using this code:

  try {                  


        
相关标签:
4条回答
  • 2021-01-05 11:27

    Goto C:\Program Files (x86)\ejabberd-2.1.8\conf (in my case) folder & open ejabberd.cfg file using Notepad++ (it is easy to edit using it).

    In the file do the following changes:

    %% Put this in the section ACCESS RULES
    {access, register_from, [{allow, admin}]}.
    
    %% Change mod_register so it contains the new access rule:
    
    {mod_register, [
              {access_from, register_from},
               ...
                        ] ...
    
    0 讨论(0)
  • 2021-01-05 11:38

    In my case, i need to edit the file EJABERD_HOME/conf/ejabberd.yml, on mod_register change parameters to:

    ip_access : all
    
    access_from : all
    
    access: register
    

    To allow users register from another host

    0 讨论(0)
  • 2021-01-05 11:42

    I want to update the answer to reflect the change in Asmack library version 4.0 onward. Connection.getAccountManager() is now AccountManager.getInstance(XMPPConnection)

    AccountManager accountManager=AccountManager.getInstance(connection);
    try {
        accountManager.createAccount("username", "password");
    } catch (XMPPException e1) {
        Log.d(e1.getMessage(), e1);
    }
    
    0 讨论(0)
  • 2021-01-05 11:45

    For yaml configuration as follows.

    access_rules:
      local:
        allow: all
      configure:
        allow: all
      trusted_network:
        allow: all
      register:
        allow: all
      .......
    
    modules:
      mod_register:
        ip_access: trusted_network
        access: register
        access_from: all
    

    Note: This is allow all configuration. Make strict configuration as required.

    0 讨论(0)
提交回复
热议问题