powered by Jive Software

SASL Authentication failed while connecting to facebook chat server

Hi all,

I am tryinto connect to facebook chat server.Following is the Authentication code:

SASLAuthentication.registerSASLMechanism(“DIGEST-MD5”, SASLDigestMD5Mechanism.class); SASLAuthentication.supportSASLMechanism(“DIGEST-MD5”, 0);

ConnectionConfiguration config = new ConnectionConfiguration("chat.facebook.com",5222,"chat.facebook.com");
connection = new XMPPConnection(config);
config.setSASLAuthenticationEnabled(true);
connection.connect();
connection.login(userName, password);

But it throws me SASL authentication failed error:

Exception in thread “main” SASL authentication failed using mechanism DIGEST-MD5: at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java: 325) at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:395) at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:349) at JabberSmackAPIFacebook.login(JabberSmackAPIFacebook.java:31) at JabberSmackAPIFacebook.main(JabberSmackAPIFacebook.java:77)

I have even enabled

config.setSASLAuthenticationEnabled(true);

can anyone pls guide me

Thanks:)

Y does no one reply here???

We have similar problems T.T

When I am trying to connect to gtalk server, the reply is “javax.net.ssl.SSLKeyException: RSA premaster secret error”

I also can‘t connect to openfire with tls, but when I turn off the tls on openfire , it’s ok.

somebody says that add “SASLAuthentication.supportSASLMechanism(“PLAIN”, 0);” before connection.login(), but it doesn’t work on my situation.

have you tried to connect gtalk? if you did it before, please help me.

btw this forum is really desolate.

Hi

I was able to connect to gatlk without much issues…below is my login code:

public void login(String userName, String password) throws XMPPException

{

ConnectionConfiguration config = new ConnectionConfiguration(“talk.google.com”,5222,“gmail.com”);

connection = new XMPPConnection(config);

config.setSASLAuthenticationEnabled(false);

connection.connect();

connection.login(userName, password);

System.out.println(connection.isAuthenticated());

}

This is more than enough.By default it supports SASL plain mechanism.No need to add SASLAuthentication.supportSASLMechanism(“PLAIN”, 0);

Thank you for your reply.

But the problem is still make me trouble. I have tried similar code like yours before, below is my latest login code (the same to yours):

public static void main(String[] args) throws XMPPException {

ConnectionConfiguration config = new ConnectionConfiguration(“talk.google.com”,5222,“gmail.com”);

XMPPConnection connection = new XMPPConnection(config);

config.setSASLAuthenticationEnabled(false);

connection.connect();

                connection.login("vwyangwei@gmail.com", password);

System.out.println(connection.isAuthenticated());

}

The raw Console output is:

javax.net.ssl.SSLKeyException: RSA premaster secret error

at com.sun.net.ssl.internal.ssl.RSAClientKeyExchange.(Unknown Source)

at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverHelloDone(Unknown Source)

at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(Unknown Source)

at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Unknown Source)

at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Unknown Source)

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)

This puzzled me, you can using the same code to connect to gtalk successful, and I can get ping reply from gtalk server too, but an entirely different conclusion come to me, have you changed your google account setting about the SSL connection?

In the mean time, I using the code upon to connect my openfire server( turn off the tls ), the result is: “Exception in thread “main” not-authorized(401)”

I changed the code like “config.setSASLAuthenticationEnabled(true);” , it works.

When the tls on openfire is on , both the true or false setting is invalid.

I googled the problem, found that not a little people sharing the same problem like me —following the sample on smack manual, tried to connect gtalk or jabber server , finally come to the RSA error— and nobody can slove it, I hope the development team can update the sample or explain the problem.

Maybe I talked too much, thanks again for your kindness reply.

@bumblebee - It appears from other posts that you resolved this problem. Could you share that solution so that everyone else can benefit from it

Thanks!

Up

as rcollier said, could you share your solution please

Thank you.

I had the same problem. There’s a huge thread on this, and the solution for 3.2.0 version is in this post:

By Jerry Magill on May 26, 2011

You have to compile that custom class and use it the way it’s shown in the post. Works just fine.**
**

Try out this full snippet for facebook login. http://fbserver.99k.org/Facebook.rar

Regards

Here’s my another solution.Checked both google & facebook.Implemented using Thread.Also includes the MD5 checksum class http://fbserver.99k.org/smack_google_facebook.rar

Here’s my another solution.Checked both google & facebook.Implemented using Thread.Also includes the MD5 checksum class http://fbserver.99k.org/smack_google_facebook.rar

Upgrade smack library to 3.2.2 or above.

It will resolve issue 100%