Java – try to log in to XMPP server with smack result and “unauthorized” in SASL

I tried to log in to the XMPP server using smack When I try to log in, I receive the following error message:

I have been able to connect and log in to the server using psi - Im with the same credentials

This is what I currently have:

System.setProperty("smack.debugEnabled","true");
    XMPPConnection.DEBUG_ENABLED = true;

    SASLAuthentication.supportSASLMechanism("PLAIN",0);

    ConnectionConfiguration configuration = new ConnectionConfiguration("chat.bla.com",5223);
    configuration.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
    configuration.setSocketFactory(new DummySSLSocketFactory());
    configuration.setSASLAuthenticationEnabled(true);
    configuration.setDebuggerEnabled(true);
    configuration.setServiceName("bla.net");

    Connection connection = new XMPPConnection(configuration);

    try {
        connection.connect();
        connection.login("user@bla.net","blablabla");
    } catch (XMPPException e) {
        e.printStackTrace();
    }

This is the dummysslsocketfactory I use: http://svn.igniterealtime.org/svn/repos/spark/tags/spark_2_5_3_s/src/java/org/jivesoftware/spark/util/DummySSLSocketFactory.java

I was thinking, the problem is, when I connect through psi, I need to select "old SSL", but I don't know how to do this in Java

Thank you for any help

Solution

Try logging in () without using the domain name part of the user name:

connection.login("user","password");

no

connection.login("user@example.org","password");
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>