We have two server one server done authentication through restful API and other is doing authentication from the local db of mongoosim. My authentication gets failed on the server which is doing authentication through mongooseim db.
These are the captured packets for session
D/SMACK: SENT (0): <stream:stream xmlns='jabber:client' to='ip' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' from='test@ip' xml:lang='en'>
D/SMACK: RECV (0): <?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='BB3E907D81DDDB71' from='ip' version='1.0' xml:lang='en'><stream:features><starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism><mechanism>DIGEST-MD5</mechanism><mechanism>SCRAM-SHA-1</mechanism></mechanisms><register xmlns='http://jabber.org/features/iq-register'/><sm xmlns='urn:xmpp:sm:3'/></stream:featur
This is the exception I'm getting while authenticating.
01-29 15:58:21.673 4793-5035/com.safarifone.waafi.debug W/System.err: org.jivesoftware.smack.sasl.SASLErrorException: SASLError using PLAIN: not-authorized
01-29 15:58:21.684 4793-5035/com.safarifone.waafi.debug W/System.err: at org.jivesoftware.smack.SASLAuthentication.authenticationFailed(SASLAuthentication.java:291)
01-29 15:58:21.687 4793-5035/com.safarifone.waafi.debug W/System.err: at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1096)
01-29 15:58:21.688 4793-5035/com.safarifone.waafi.debug W/System.err: at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPConnection.java:994)
01-29 15:58:21.690 4793-5035/com.safarifone.waafi.debug W/System.err: at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:1010)
Captured packets
D/SMACK: SENT (0): <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN'>ADkyMzE1NTEwNDI5MgA=</auth>
D/SMACK: RECV (0): <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><not-authorized/></failure>
This is how I've configured my client
XMPPTCPConnectionConfiguration.Builder builder = XMPPTCPConnectionConfiguration.builder()
.setUsernameAndPassword(mAccount.getUserName(), mAccount.getPassword())
.setXmppDomain(com.safarifone.settings.Settings.IM_SERVER)
.setHost(mAccount.getHost())
.setPort(mAccount.getPort())
.setKeystoreType(null)
.setSendPresence(true)
.setResource(IMConstant.XMPP_RESOURCE)
.setDebuggerEnabled(true)
.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled)
.setConnectTimeout(IMService.CONNECT_TIMEOUT);
Log.d(TAG, "Setting TLS Certificates Settings for XMPPTCPConnectionConfiguration Object ");
// TLSUtils.acceptAllCertificates(builder);
Log.d(TAG, "Setting XMPPTCPConnection Static StreamManagement Default Properties to true ");
XMPPTCPConnection.setUseStreamManagementDefault(true);
XMPPTCPConnection.setUseStreamManagementResumptionDefault(true);
Log.d(TAG, "Setting SASLAuthentication Blacklist");
SASLAuthentication.unBlacklistSASLMechanism("PLAIN");
SASLAuthentication.blacklistSASLMechanism("DIGEST-MD5");
SASLAuthentication.blacklistSASLMechanism("SCRAM-SHA-1");
SASLAuthentication.registerSASLMechanism(new SASLPlainMechanism());
Note : I'm able to authenticate if i use some other client like jitsi.