我正在嘗試使用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;
}
看起來你配置文件的縮進是錯誤的。 –