How to handle wrong username or password in smack4.1

Hi all,

I am using smack4.1 for android chat app.

I am getting below exception when i using wrong username or password.

Exception:

04-30 08:16:11.941: W/System.err(2149): org.jivesoftware.smack.sasl.SASLErrorException: SASLError using DIGEST-MD5: not-authorized

04-30 08:16:11.971: W/System.err(2149): at org.jivesoftware.smack.SASLAuthentication.authenticationFailed(SASLAuthenticati on.java:365)

04-30 08:16:11.971: W/System.err(2149): at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPC onnection.java:1033)

04-30 08:16:11.971: W/System.err(2149): at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPCon nection.java:937)

04-30 08:16:11.971: W/System.err(2149): at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnecti on.java:952)

04-30 08:16:11.971: W/System.err(2149): at java.lang.Thread.run(Thread.java:841)

After getting this error, i am unable loggin event using the correct username and password.

Please help me how to handle it.

Thanks in advance…

That depends on the XMPP server. Nothing in the XMPP spec prevents you from trying the authentication/login again after not-authorized. If this doesn’t work, as you describe, then you can only call disconnect(), connect() and try to login() again.