I am using Smack library version 4.1.8. When I am trying to connect openfire server, I am getting SASLError like below.
W/System.err: org.jivesoftware.smack.sasl.SASLErrorException: SASLError using PLAIN: not-authorized
W/System.err: at org.jivesoftware.smack.SASLAuthentication.authenticationFailed(SASLAuthenticati on.java:365)
My Java code for connecting to server is as follow:
XMPPTCPConnectionConfiguration conf = XMPPTCPConnectionConfiguration
.builder()
.setServiceName(ApplicationHelper.XMPPCONFIG.SERVICE)
.setHost(ApplicationHelper.XMPPCONFIG.HOST)
.setPort(ApplicationHelper.XMPPCONFIG.PORT)
.setUsernameAndPassword(Pref.getValue(getApplicationContext(), AppPrefrences.PREF_XMPP_USER_ID, “”) + “@” + ApplicationHelper.XMPPCONFIG.HOST, “123”)
.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled)
// .setHostnameVerifier(mtm.wrapHostnameVerifier(new org.apache.http.conn.ssl.StrictHostnameVerifier()))
// .setCustomSSLContext(sc)
.build();
mConnection = new XMPPTCPConnection(conf);
try {
mConnection.addConnectionListener(mConnectionListener);
mConnection.connect();
SASLMechanism mechanism = new SASLDigestMD5Mechanism();
SASLAuthentication.registerSASLMechanism(mechanism);
SASLAuthentication.blacklistSASLMechanism(“SCRAM-SHA-1”);
SASLAuthentication.blacklistSASLMechanism(“DIGEST-MD5”);
mConnection.login(Pref.getValue(getApplicationContext(), AppPrefrences.PREF_XMPP_USER_ID, “”) + “@” + ApplicationHelper.XMPPCONFIG.HOST, “123”);
Please advise me to get rid of this problem. Now this is headache for me.