Take the 2-minute tour ×

I have big problem. Every time when I'm trying to connect to any jabber server I have got "SASL authentication DIGEST-MD5 failed" notification. I dont have this error when I dont use JPasswordField, but using JTextField in IM is pointless. I have tried every method I found, but it's all thesame.

The code:

private void bLoginAction(JTextField login, JPasswordField pass) {
loginText = login.getText();
passText = pass.getPassword().toString();
String[] data = loginText.split("@");
Connection.DEBUG_ENABLED = true;
Connection con = new XMPPConnection(config);
 try {
 } catch (XMPPException e) {
try {
 con.login(loginText, passText);
 } catch (XMPPException e) {

Print from printStackTrace():

SASL authentication DIGEST-MD5 failed: invalid-authzid: at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java: 337) at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:203) at org.jivesoftware.smack.Connection.login(Connection.java:348)

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Don't use toString(). Try using getPassword() instead as shown here. Even with a JTextField, you should be using getText() instead of toString().

This is not a smack issue but a straight up Java one.

share|improve this answer
Thank you very much. It worked perfectly! I just have to build String from char[]. String passText = new String ( pass.getPassword()); if anybody need this;) –  Ragnar Jul 11 '12 at 14:46
add comment

Your Answer


