Smack 4.1.0 alpha6 - SASLError using DIGEST-MD5: not-authorized

I am having getting error response with ALPHA-7 version .

Below is my code

xmppConnectionConfigurationBuilder = XMPPTCPConnectionConfiguration.builder();
xmppConnectionConfigurationBuilder.setPort(AppConfig.PORT);
xmppConnectionConfigurationBuilder.setHost(AppConfig.HOST);
xmppConnectionConfigurationBuilder.setUsernameAndPassword(AppSetting.getString(c ontext, PreferenceKey.JID, Util.getChatId(context).toLowerCase()),AppSetting.getString(context, PreferenceKey.PASSWORD,Util.getChatId(context).toLowerCase()));
xmppConnectionConfigurationBuilder.setServiceName(AppConfig.HOST);
xmppConnectionConfigurationBuilder.setDebuggerEnabled(true);
xmppConnectionConfigurationBuilder.setSecurityMode(SecurityMode.disabled);
xmppConnectionConfigurationBuilder.setRosterLoadedAtLogin(true);
xmppConnectionConfigurationBuilder.setCallbackHandler(callbackHandler);
xmppConnectionConfigurationBuilder.setSendPresence(false);
xmppConnectionConfigurationBuilder.setResource(null);

try {

TLSUtils.acceptAllCertificates(xmppConnectionConfigurationBuilder);

} catch (KeyManagementException e) {

e.printStackTrace();

} catch (NoSuchAlgorithmException e) {

e.printStackTrace();

}

if (connection == null){

connection = new XMPPTCPConnection(xmppConnectionConfigurationBuilder.build());

}

else{

connection.disconnect();

}

connection.connect();

connection.login();

XMPPTCPConnection.setUseStreamManagementDefault(true);

And i am having following response , i tried with same credential with asmack and its working by chaining some code .

  • 12-08 19:18:00.839: D/SMACK(14117): RECV (0): stream:featuresDIGEST-MD5PLAINANONYMOUSCRAM-MD5</mech anism>zlib</stream:features>
  • 12-08 19:18:00.839: D/SMACK(14117): SENT (0): =
  • 12-08 19:18:00.871: D/SMACK(14117): RECV (0): cmVhbG09Im9iMTIwLTUwIixub25jZT0iZU1Obn JYVlcwOW05cjJweDZQSmdQb045d0F1Vi8yNWxTa1VLRzdFQSIscW9wPSJhdXRoIixjaGFyc2V0PXV0Zi 04LGFsZ29yaXRobT1tZDUtc2Vzcw==
  • 12-08 19:18:00.871: D/SMACK(14117): SENT (0): dXNlcm5hbWU9ImRob25pIixyZWFsbT0iMTcyLj E2LjEyMC40NiIsbm9uY2U9ImVNTm5yWFZXMDltOXIycHg2UEpnUG9OOXdBdVYvMjVsU2tVS0c3RUEiLG Nub25jZT0icDFYNDNna3FCMXhrQTI4UzA1Q1czekN3WkdIbk9HQTEiLG5jPTAwMDAwMDAxLHFvcD1hdX RoLGRpZ2VzdC11cmk9InhtcHAvMTcyLjE2LjEyMC40NiIscmVzcG9uc2U9ZTNjNGY3NDI1ZGQ2ODVlOT c4MDZkNDkwZDQ5Yzk3NzcsY2hhcnNldD11dGYtOA==
  • 12-08 19:18:00.875: D/SMACK(14117): RECV (0):

I have a similar setup as well, but no luck just yet even with the previous suggestions implemented.

Hi Flow, any update for this issue? Thank!

No sorry, I didn’t had time to look into this further.

But it would be helpful if someone could verify if it works with the recent Openfire 3.10 alpha’s.

I tried this version with a prosody server and it seems to not throw this error.

I’m playing with DIGEST-MD5: not-authorized problem again. I downloaded latest source code from smack (alpha7) and see new exception when creating new connection configuration via XMPPTCPConnectionConfiguration.builder(). Any ideas?

Could not enable secure processing parsing feature
    javax.xml.parsers.ParserConfigurationException: http://javax.xml.XMLConstants/feature/secure-processing
            at org.apache.harmony.xml.parsers.DocumentBuilderFactoryImpl.setFeature(DocumentBuilderFactoryImpl.java:101)
            at org.jivesoftware.smackx.vcardtemp.provider.VCardProvider.<clinit>(VCardProvider.java:94)
            at java.lang.reflect.Constructor.newInstance(Native Method)
            at java.lang.Class.newInstance(Class.java:1572)
            at org.jivesoftware.smack.provider.ProviderFileLoader.<init>(ProviderFileLoader.java:86)
            at org.jivesoftware.smack.initializer.UrlInitializer.initialize(UrlInitializer.java:53)
            at org.jivesoftware.smack.SmackInitialization.loadSmackClass(SmackInitialization.java:235)
            at org.jivesoftware.smack.SmackInitialization.parseClassesToLoad(SmackInitialization.java:196)
            at org.jivesoftware.smack.SmackInitialization.processConfigFile(SmackInitialization.java:166)
            at org.jivesoftware.smack.SmackInitialization.processConfigFile(SmackInitialization.java:151)
            at org.jivesoftware.smack.SmackInitialization.<clinit>(SmackInitialization.java:118)
            at org.jivesoftware.smack.SmackConfiguration.getVersion(SmackConfiguration.java:96)
            at org.jivesoftware.smack.ConnectionConfiguration.<clinit>(ConnectionConfiguration.java:41)

Do you “see” the exception or is it “thrown at you”?

I “see” the exception. It is thrown by XMPPTCPConnectionConfiguration.builder().

I don’t think that builder() throws this exception.

Smack just logs this exception. What’s the log level the exception is logged with?

You are right it is info level. It shouldn’t be problem.

Is it any chance to fix not-authorized problem? :slight_smile:

Hi Flow,

I’m made little research about the issue and the problem starts after commit c81cd3456146d788080923d0acc2ac7371f82c97 (Apply builder pattern to ConnectionConfiguration)

H.

After means that the following commit introduced that behavior? That would be Add reply timeout to NoResponseException message · def8fea · igniterealtime/Smack · GitHub . I doubt that.

I just found the issue :slight_smile: It was MINE mistake with combination with new bahaviour after commit c81cd3456146d788080923d0acc2ac7371f82c97. I had misspelling service name. Before this commit it was no problem and everything works fine, but after this commit I just received SASLError using DIGEST-MD5: not-authorized (change is in XMPPTCPConnection PacketReader, case “stream”).

Just so I can follow: Where exactly (which API) did you misspell something?

I just misspell service name.

Wrong (mydervice.com):

XMPPTCPConnectionConfiguration.Builder conf = XMPPTCPConnectionConfiguration.builder();
conf.setServiceName("mydervice.com");
...

Correct (myservice.com):

XMPPTCPConnectionConfiguration.Builder conf = XMPPTCPConnectionConfiguration.builder();
conf.setServiceName("myservice.com");
...

If you need more info, just let me know.

Thank you. It’s very helpful to me.