I’ve seen several people looking for code to connect to Facebook Chat via Smack.
I’ve posted my solution to this here: http://community.igniterealtime.org/message/220711#220711 But I’m repeating in its own thread, that is not about MD5-Digest, to make it easier to find.
The attached source is a new version of the SASL Mechanism posted in the original thread.
To use it, you need an access token that you can get from Facebook (see http://developers.facebook.com/docs/authentication/). Facebook (in https://developers.facebook.com/docs/chat/) recommend you use the client flow to get the token, and that’s what I did; the server flow is supposed to yield a similar token, so it should work just as well.
The usage code looks like:
ConnectionConfiguration config = **new** ConnectionConfiguration("chat.facebook.com", 5222);
XMPPConnection connection = **new** XMPPConnection(config);
connection.login(apiKey, accessToken, "Client Name"); // Client name optional
Hope this helps,
SASLXFacebookPlatformMechanism.java.zip (1576 Bytes)