当前位置 : 主页 > 手机开发 > android >

登录异常SASL身份验证在android中使用机制DIGEST-MD5 asmack失败

来源:互联网 收集:自由互联 发布时间:2021-06-11
我尝试连接Xmpp服务器,但我得到例外 使用DIGEST-MD5机制登录异常SASL身份验证失败 我使用这个代码,任何人都可以帮助我,或代码 try { if (xmppConnection == null) { ConnectionConfiguration config = new Co
我尝试连接Xmpp服务器,但我得到例外

使用DIGEST-MD5机制登录异常SASL身份验证失败

我使用这个代码,任何人都可以帮助我,或代码

try {
        if (xmppConnection == null) {
            ConnectionConfiguration config = new ConnectionConfiguration(
                    SERVER_HOST, SERVER_PORT, SERVICE_NAME);
            xmppConnection = new XMPPConnection(config);
            System.out.println("xmppConnection"+xmppConnection);
        }

        if (!xmppConnection.isConnected()) {
            xmppConnection.connect();
            System.out.println("Connecting");
        }

        System.out.println("facebook id get xmpp "+username);

        if (!xmppConnection.isAuthenticated()) {
            xmppConnection.login(username, "123");
            System.out.println("User is authenticated ");

        }
        Presence presence = new Presence(Presence.Type.available);
        xmppConnection.sendPacket(presence);
                 } catch (Exception e) {
        System.out.println("Login exception "+e);
        e.printStackTrace();
    }
在Openfire配置中,它是machinename.domain.com

此SASL机制还使用Xmpp域名进行身份验证,而不仅仅是用户名和密码.这就是验证失败的原因.

表示您的用户名和&密码必须如下:

用户名:abc111@domain.com(无论您的域名是什么)

密码:abcabc111

有关详细信息,请查看此conversation.

网友评论