AnsweredAssumed Answered

Problem with org.jivesoftware.smack.sasl.SASLErrorException: SASLError using DIGEST-MD5: not-authorized

Question asked by Patryk on Feb 10, 2015
Latest reply on Apr 28, 2016 by Vinod Singh

Hey,

 

I'm trying to connect via client I am working on to the local instance of the Openfire server.

 

While trying to login to the server I'm getting an error.

I am able to connect to the server with my credentials, through Adium, so it's not a problem of the credentials.

 

I am using following dependencies:

    compile 'org.igniterealtime.smack:smack-tcp:4.1.0-beta2'

    compile 'org.igniterealtime.smack:smack-core:4.1.0-beta2'

    compile 'org.dnsjava:dnsjava:2.0.6'

    compile 'org.igniterealtime.smack:smack-android:4.1.0-beta2'

    compile 'org.igniterealtime.smack:smack-extensions:4.1.0-beta2'

 

Here is the error message:

10 12:48:12.049    2391-2466/com.xxx.xxx D/SMACK﹕ SENT (0): <stream:stream xmlns='jabber:client' to='192.168.19.50' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xml:lang='en'>

02-10 12:48:12.057    2391-2467/com.xxx.xxx D/SMACK﹕ RECV (0): <?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="iliyan.local" id="648898d9" xml:lang="en" version="1.0">

02-10 12:48:12.061    2391-2467/com.xxx.xxx D/SMACK﹕ RECV (0): <stream:features><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism >ANONYMOUS</mechanism><mechanism>CRAM-MD5</mechanism><mechanism>DIGEST-MD5</mech anism></mechanisms><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><auth xmlns="http://jabber.org/features/iq-auth"/><register xmlns="http://jabber.org/features/iq-register"/></stream:features>

02-10 12:48:12.071    2391-2465/com.xxx.xxx D/ChatController﹕ connected: org.jivesoftware.smack.tcp.XMPPTCPConnection@46395b2

02-10 12:48:12.074    2391-2466/com.xxx.xxx D/SMACK﹕ SENT (0): <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='DIGEST-MD5'>=</auth>

02-10 12:48:12.079    2391-2467/com.xxx.xxx D/SMACK﹕ RECV (0): <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cmVhbG09ImlsaXlhbi5sb2NhbCIsbm9uY2U9Im 9PT3ZTWnRnSWlXWkZ2aHU5b09kRzhrT05veUt0MG03SVphVkF2N2IiLHFvcD0iYXV0aCIsY2hhcnNldD 11dGYtOCxhbGdvcml0aG09bWQ1LXNlc3M=</challenge>

02-10 12:48:12.085    2391-2466/com.xxx.xxx D/SMACK﹕ SENT (0): <response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>dXNlcm5hbWU9InRlc3QiLHJlYWxtPSIxOTIuMT Y4LjE5LjUwIixub25jZT0ib09PdlNadGdJaVdaRnZodTlvT2RHOGtPTm95S3QwbTdJWmFWQXY3YiIsY2 5vbmNlPSIwblZXVE43MU1ISFhxejZLZHRwVm9PMUZ4Mkcyd1BuRyIsbmM9MDAwMDAwMDEscW9wPWF1dG gsZGlnZXN0LXVyaT0ieG1wcC8xOTIuMTY4LjE5LjUwIixyZXNwb25zZT02YjgyMzliODkwMzgwN2VhMz k2MmM2Y2U5NzA3YWZlNixjaGFyc2V0PXV0Zi04</response>

02-10 12:48:12.090    2391-2467/com.xxx.xxx D/SMACK﹕ RECV (0): <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure>

02-10 12:48:12.094    2391-2469/com.xxx.xxx W/System.err﹕ org.jivesoftware.smack.sasl.SASLErrorException: SASLError using DIGEST-MD5: not-authorized

02-10 12:48:12.095    2391-2469/com.xxx.xxx W/System.err﹕ at org.jivesoftware.smack.SASLAuthentication.authenticationFailed(SASLAuthenticati on.java:365)

02-10 12:48:12.095    2391-2469/com.xxx.xxx W/System.err﹕ at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPC onnection.java:992)

02-10 12:48:12.095    2391-2469/com.xxx.xxx W/System.err﹕ at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPCon nection.java:896)

02-10 12:48:12.095    2391-2469/com.xxx.xxx W/System.err﹕ at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnecti on.java:911)

 

 

Here is my implementation:

final XMPPTCPConnectionConfiguration connectionConfiguration = XMPPTCPConnectionConfiguration.builder()

                .setServiceName(SERVER_ADDRESS)

                .setPort(SERVER_PORT)

                .setCompressionEnabled(false)

                .setDebuggerEnabled(true)

                .setSecurityMode(ConnectionConfiguration.SecurityMode.disabled)

                .build();

 

        mConnection = new XMPPTCPConnection(connectionConfiguration);

 

mConnection.connect();

 

mConnection.login("test", "12345678");

 

I tried changing the username to test@SERVER_ADDRESS, no effect.

 

How can I fix this problem?

Outcomes