2015-05-13 19 views
5

Sto provando a creare un nuovo utente tramite l'account amministratore. Ma ricevo l'errore di autenticazione. Ho provato risposte come this, ma non aiuta.Errore Smack XMPP durante la creazione di un nuovo utente: proibito - auth

Il mio codice per la creazione di un nuovo utente:

AccountManager accountManager = AccountManager.getInstance(mConnection); 

     if (accountManager.supportsAccountCreation()) { 
      try { 
       accountManager.createAccount(username, password); 
      } 

      catch (XMPPException ex) { 
       LOG.info(ex.getMessage(), ex); 
      } 

     } 
     else{ 
      LOG.error("Server doesn't support creating new accounts"); 
     } 

E mi permetto di registrazione per tutti in config:

{access, register, [{allow, all}]}. 

{access, register_from, [{allow, all}]}. 

{mod_register, [ 
... 
{ip_access, [{allow, "127.0.0.0/8"}, 
       {deny, "0.0.0.0/0"}]}, 
{access_from, register_from}, 
{access, register} 
]}, 

E anche con questa configurazione ho errore:

org.jivesoftware.smack.XMPPException$XMPPErrorException: XMPPError: forbidden - auth 
    at org.jivesoftware.smack.XMPPException$XMPPErrorException.ifHasErrorThenThrow(XMPPException.java:135) 
    at org.jivesoftware.smack.PacketCollector.nextResultOrThrow(PacketCollector.java:232) 
    at org.jivesoftware.smack.PacketCollector.nextResultOrThrow(PacketCollector.java:213) 
    at org.jivesoftware.smackx.iqregister.AccountManager.createAccount(AccountManager.java:272) 
    at org.jivesoftware.smackx.iqregister.AccountManager.createAccount(AccountManager.java:244) 

PS Smack 4.1.0

+0

Sei sicuro che stai bene con '{ip_access, [{allow," 127.0.0.0/8 "}, {deny," 0.0.0.0/0 "}]}', cioè ti stai connettendo dal locale ospite? – erszcz

+0

@erszcz oh, ho dimenticato questo. Aggiunto il mio ip nella lista dei permessi -> ora funziona. Grazie compagno. – Suvitruf

+0

@erszcz ma funziona solo con [{allow, all}}, con [{allow, admin}] Ricevo lo stesso errore =/ – Suvitruf

risposta

1

Soluzione:

step1: 

enter image description here

step2: 

enter image description here

step3: 

enter image description here

dopo aver eseguito tutti questi tre passaggi esegui il tuo programma sarai in grado di registrare un nuovo utente sul server ejabberd.

Problemi correlati