Problems with connecting to Facebook XMMP MD5-DIGEST

hi everyone! I’m using this api for Processing (java based) and i want to know if there’s allready a simple sollution for this? Processing uses libraries and i’ve allready connected to G-talk. Could someone give me a hint? There’s some code between it for an Eliza bot.

here’s my code:

http://paste2.org/p/1082107

here’s some debug info:

<?xml version="1.0"?>X-FACEBOOK-PLATFORMDIGEST-MD5

cmVhbG09ImNoYXQuZmFjZWJvb2suY29tIixub2 5jZT0iODhFQjBBRkIwMEZBN0M4MkUxNTZGQ0JDMDRFMkJDMTkiLHFvcD0iYXV0aCIsY2hhcnNldD11dG YtOCxhbGdvcml0aG09bWQ1LXNlc3M=

<stream:stream to=“chat.facebook.com” xmlns=“jabber:client” xmlns:stream=“http://etherx.jabber.org/streams” version=“1.0”>

Y2hhcnNldD11dGYtOCx1c2VybmFtZT0ibWFydG lqbm1lIixyZWFsbT0iY2hhdC5mYWNlYm9vay5jb20iLG5vbmNlPSJDRTVDOTYwQ0RBMzM0NjdGMTE4OU FGMzkzRkRCODU1MiIsbmM9MDAwMDAwMDEsY25vbmNlPSJVK1oxb1JyNk9sK3JudzJXZTR0d0hueFMrVG RqNDlXcUV0azZJQWhBIixkaWdlc3QtdXJpPSJ4bXBwL2NoYXQuZmFjZWJvb2suY29tIixtYXhidWY9Nj U1MzYscmVzcG9uc2U9OTY4MWVmOTkwNjUzNTBiNDFkNDQ0YzY0NTkxNjczMTkscW9wPWF1dGgsYXV0aH ppZD0ibWFydGlqbm1lIg==
Hello. How do you do. Please state your problem.b2F860

</stream:stream>
<stream:stream to=“chat.facebook.com” xmlns=“jabber:client” xmlns:stream=“http://etherx.jabber.org/streams” version=“1.0”>

Hi @Kees,

If you can connect to gtalk then you shouldn’t have any issue connecting to facebook using digest-md5. Just make you sure you have a proper facebook user ID (not your email address). You can get your username by logging into facebook and looking under account settings there will be something called “Username”.

try something like

test@chat.facebook.com

password

server should be - chat.facebook.com

port - 5222

i get this:

ASL authentication failed using mechanism DIGEST-MD5:

I’ve allready got a username and inserted this

hello kees…i had this problem just a few days ago…now i have solved it & my app is working too fine!

u dont need SASL md5 for google.U need it only for facebook.here’s the code snippet:

try
{

if(frameName==“Facebook”)
{

SASLAuthentication.registerSASLMechanism(“DIGEST-MD5”,MySASLDigestMD5Mechanism. class);

config = new ConnectionConfiguration(“chat.facebook.com”,5222);
config.setSASLAuthenticationEnabled(true);
config.setRosterLoadedAtLogin (true);
}
if(frameName==“gTalk”)
{
config = new ConnectionConfiguration(“talk.google.com”,5222, “gmail.com”);
config.setSASLAuthenticationEnabled(false);
config.setRosterLoadedAtLogin (true);
}

}

catch(Exception ex)

{ex.printStackTrace();}

////ur code proceeds

if u do ur code in jcreator or netbeans u have to include this jar SASLin ur project.

may be u need to add this:

config.setSASLAuthenticationEnabled(true);

this reply is intended for PEDRO!

Yup, that definantly worked… THANK YOU VERY MUCH!!! YOU SAVED MY PROJECT

then u should have liked it ! lol! by the way what type of project is this? i worked on one a few days ago for my term completion in University!

I study art academy, Interaction Design, i’m combining a bot called Eliza(one of the first bots ever) together with facebook chat. I’m making a fake profile and let people interact with this person to check what are the results. After that i’m gonna modify the bot to an megalomaniac person and try to annoy people with it. The results i’m gonna make a book out of it.

interesting!keep it up!

I have still one problem… how do i use the getchat command then? I’ve tried an userID like this:

newChat = chatmanager.createChat(“10430122958887”, new MessageListener() {

put @chat.facebook.com after it, but it doesn’t send any messages. Tried full name. How did you do this?

EDIT:

solved! Just put in “-@chat.facebook.com” don’t forget the “-”

i almost came with the solution but u got it before…great!

if u have any problem further related to chat try this (its from my project):

private class messageProcessor implements MessageListener
{

            Chat chat;//chat variable
            public messageProcessor(String address)//constructor recieving the address of the participant
            {
                chat = connection.getChatManager().createChat(to, this);
            }
           
            public void processMessage(Chat chat, Message message)
                    {
                        try
                        {
                       
                            Thread.sleep (3000);
                        }
                        catch(Exception ex){};
                        if(message.getType() == Message.Type.chat)
                            if(message.getBody ()!=null)
                                setIncomingMessage(message.getBody());
                       
                    }
               
               
       
            public void sendMessage(String message) throws XMPPException
            {
               
                chat.sendMessage(message);
                try{Thread.sleep (600);}catch(Exception ex){};
               
            }
   }

HI ,

I tried the same thing .

Changed the smack library . Added null

sc = Sasl.createSaslClient(mechanisms, null, “xmpp”, host, props, this);

on all locations .

Still I am getting not authorized . Do we need to enable any thing like xmpp_login ?

Am I missing some thing

not clear enough what u tried to say or supposed to do.if u r trying to connect to Facebook than just scroll upward & u will find a solution posted by me! that worked for me & others & hope will for u too!dont forget to like my solution!

Thanks what I found was it was not working for some logins .

Just now Now it is working .

Thanks

Mahesh

HI ,

I have a doubt with X-FACEBOOK.

I am confused with the login behaviour of the same .Is it possible to write applications such as chat bots with this mechanism .What is the relation to session key and chat Can a chat application using this mechanim, send message to a face book user .

regards

mahesh

Hi,

recently I try to connect Facebook Chat with smack.

I try all solutions everyone mentioned.

But I always got error message “failed using mechanism DIGEST-MD5:” and sometimes it just worked with the same code.

Can you help me to deal with this problem?

Thanks

Hi,

I am getting following error

java.lang.NullPointerException

at org.jivesoftware.smack.sasl.SASLMechanism.authenticate(SASLMechanism.java:117)

at MySASLDigestMD5Mechanism.authenticate(MySASLDigestMD5Mechanism.java:43)

at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java: 308)

at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:395)

at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:349)

my code is

SASLAuthentication.registerSASLMechanism(“DIGEST-MD5”,

MySASLDigestMD5Mechanism. class);

ConnectionConfiguration config = new ConnectionConfiguration(“chat.facebook.com”,5222);

config.setSASLAuthenticationEnabled(true);

config.setRosterLoadedAtLogin (true);

XMPPConnection connection = new XMPPConnection(config);

connection.connect();

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

connection.login(“xxxxxxxxx”, “xxxxxx”);

How to do it, Please explain, Its urgent…

SASL authentication DIGEST-MD5 failed: not-authorized:

hi, I’m trying to using your file. but : SASL authentication DIGEST-MD5 failed: not-authorized.

my code:

SASLAuthentication.registerSASLMechanism(“DIGEST-MD5”, MySASLDigestMD5Mechanism1.class);

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

config = new ConnectionConfiguration(“chat.facebook.com”, 5222, “chat.facebook.com”);

config.setSASLAuthenticationEnabled(true);

config.setSecurityMode(ConnectionConfiguration.SecurityMode.enabled);

config.setSendPresence(false);

config.setSocketFactory(proxy.getSocketFactory());

//

conn = new XMPPConnection(config);

try {

System.out.println(“connect…”);

conn.connect();

conn.addConnectionListener(this);

System.out.println(“connected…”);

conn.login(username, pd, “leolee.com”);

} catch (XMPPException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

thank you.

Hi there!!

I’m quite new at this. I downloaded your file and I am get an error with your las sentence:

getSASLAuthentication().send(stanza.toString());

It’s all the time saying that the method send is not applicable for the type String. What is wrong with this???

I just want to try and connect with FB and I see that many of those who have used your file now can connect properly.

Thanks in advance.