我正在尝试通过管理员帐户创建新用户。但是我收到了auth错误。 我试过像this这样的答案,但它没有帮助。
我创建新用户的代码:
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");
}
我允许在配置中注册ALL:
{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}
]},
即使使用此配置我也有错误:
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)
P.S。 Smack 4.1.0