我正在尝试使用smack客户端4.1.2创建用户。我正在低于错误。XMPPError:使用smack创建新用户时禁止验证错误4.1.2
Send XML on stream = <<"<iq from='abc.example.com' to='[email protected]/Smack' id='Dym8b-14' type='error'><query xmlns=jabber:iq:register><password>xxxxxx</password><username>user</username><registered/></query><error code=403 type=auth><forbidden xmlns=urn:ietf:params:xml:ns:xmpp-stanzas/></error></iq>">>
我ejabberd配置看起来像下面(.yml文件)
register_from:
admin: allow
...
access_from: register_from
access: register
我仍然得到上述错误。请帮助
添加代码片段展示如何创建使用嫌4.1.0
connection = new XMPPTCPConnection(getConnectionConfiguration());
connection.connect();
connection.login("admin", "admin");
if(connection.isAuthenticated())
{
AccountManager accountManager = AccountManager.getInstance(connection);
accountManager.sensitiveOperationOverInsecureConnection(true);
accountManager.createAccount(userName, password);
connection.disconnect();
// The account has been created, so we can now login
connection.login(userName, password);
}
private XMPPTCPConnectionConfiguration getConnectionConfiguration()
{
XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
.setServiceName("abc.example.com")
.setHost("abc.example.com")
.setPort(5222)
.build();
return config;
}
看起来你配置文件的缩进是错误的。 –