Connect error: SASL Authentication failed. No known authentication mechanisims

When trying to write my first XMPP client using Smack (4.1.0-beta1) (running against OpenFire 3.9.3) i keep getting the following error:

org.jivesoftware.smack.SmackException: SASL Authentication failed. No known authentication mechanisims

I tried all kinds of username/password settings but no luck so far. When connecting with Pidgin the connection seems ok.

Any clue what i am missing?

I also tried all possible scenario’s for the servicename and host…

XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()

.setUsernameAndPassword(“admin”, “admin”)

.setServiceName(“localhost”)

.setHost(“localhost”)

.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled)

.setPort(5222)

.build();

    XMPPTCPConnection connection = new XMPPTCPConnection(config);

    try {

        connection.connect();

connection.login(); // fails!!!

connection.disconnect();

} catch (SmackException e) {

e.printStackTrace();

} catch (IOException e) {

e.printStackTrace(); } catch (XMPPException e) {

e.printStackTrace();

}

Please follow the instructions found in https://github.com/igniterealtime/Smack/wiki/How-to-ask-for-help-or-report-an-is sue.

The solution to this problem is to add the correct dependencies. Using Gradle i added the following dependencies.

compile(“org.igniterealtime.smack:smack-core:4.1.0-beta1”)

compile(“org.igniterealtime.smack:smack-tcp:4.1.0-beta1”)

compile(“org.igniterealtime.smack:smack-extensions:4.1.0-beta1”)

compile(“org.igniterealtime.smack:smack-sasl-provided:4.1.0-beta1”)

The Smack 4.1 Readme basically tells you that you either want smack-android or smack-java7, then you don’t need to add smack-sasl-* and some more stuff will be done for you depending on the target platform.

Thanks very much for pointing me out! I missed this one completely!

Hi,

I’m using Smack 4.1.0 and I have the same problem; I read your posts but I don’t understand how to you solved the problem. Please can you explain me?

You only need to include the smack-java7 dependencies. This includes all other dependencies.

Maven example…

org.igniterealtime.smack

smack-java7

4.1.0

Smack 4.1 Readme and Upgrade Guide · igniterealtime/Smack Wiki · GitHub

Hope this helps

Can you advise what needs to be done for Gradle?