Possible duplicate:
SASL authentication error while integrating facebook chat using Smack
I am trying to compile this code and always throw this exception
SASL authentication error using the DIGEST-MD5 mechanism:
on org.jivesoftware.smack.SASLAuthentication.authenticate (SASLAuthentication.java:325)
on org.jivesoftware.smack.XMPPConnection.login (XMPPConnection.javahaps95)
on org.jivesoftware.smack .XMPPConnection.login (XMPPConnection.javahaps49)
at SimpleConnection.main (SimpleConnection.java:31)
The code:
import javax.swing.JOptionPane;
import org.jivesoftware.smack.Chat;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.MessageListener;
import org.jivesoftware.smack.SASLAuthentication;
public class SimpleConnection {
static String username = "";
static String password = "";
public SimpleConnection() {
}
public static void main(String[] args) {
try {
SASLAuthentication.registerSASLMechanism("DIGEST-MD5", MySASLDigestMD5Mechanism.class);
ConnectionConfiguration conf = new ConnectionConfiguration("chat.facebook.com", 5222);
XMPPConnection con = new XMPPConnection(conf);
con.connect();
con.login(username, password);
} catch (Exception e) {
e.printStackTrace();
}
}
}
What am I doing wrong? Thank!
source
share