我正在尝试使用smack客户端4.1.2创建用户.我收到了以下错误.
Send XML on stream = <<"<iq from='abc.example.com' to='admin@abc.example.com/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>">>
Run Code Online (Sandbox Code Playgroud)
我的ejabberd配置如下(.yml文件)
register_from:
admin: allow
...
access_from: register_from
access: register
Run Code Online (Sandbox Code Playgroud)
我仍然遇到上述错误.请帮忙
添加代码段以显示如何使用smack 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;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2459 次 |
| 最近记录: |