Problems with connecting to Facebook XMMP MD5-DIGEST

I think my problem is that my sessions are not persisting between activities, authenticate with facebook in my main activity and then I go and try to xmpp authenticate in another activity.

Did you have to use the git facebook sdk to actually allow offline permissions first?

He said he got it to work with MD-5 not X-Facebook-Platform.

Is yours with X-FACEBOOK-PLATFORM? If so Iā€™d definitely like to see the codeā€¦

With MD-5-Digest, it works flawlessly.

I am trying to get it work anyway I can. MD-5 Digest is not working for me at all. I get a request failed every time. im using the 05.07 build of the jar and the code is really straightforward

ConnectionConfiguration config = new ConnectionConfiguration(ā€œchat.facebook.comā€, 5222, ā€œchat.facebook.comā€);
myConn = new XMPPConnection(config);
config.setSASLAuthenticationEnabled(true);
config.setDebuggerEnabled(true);

myConn.connect();

//username is straight username- no @gmail.com and no @chat.facebook.com

//password is my password

myConn.login(username,password);

Log.i(ā€œXMPPā€, myConn.getHost() + ā€œ,ā€ + myConn.getServiceName());

Do you guys see anything that I am doing wrong?

I used your file, and I get the challenge but when I construct a response to to the challenge keeps failing, I have set permissions as well. Everything seems ok, but Iā€™m obviously making a mistake somewhere. Can you please help me? Iā€™m coding on java, for androidā€¦

A sample application would be really helpful.

Thanks in advance.

Hello alexryd,

sorry my English :slight_smile:

I created a chat for Android, the mechanism using X-FACEBOOK-PLATFORM. Using the library as access http://github.com/facebook/facebook-android-sdk. So until a few days ago, works great. Remove the secret from a json object that was attached to the successful response with the access token. The ā€˜secretā€™ password in the past as FacebookConnectSASLMechanism class.

Now unfortunately this object json disappears. Is no longer present in the successful response. Maybe facebook has changed something.

How can you get this secret? I tried but does not work with application secret. Could you help me? Iā€™m in trouble :slight_smile:

Thanks

it worked awesome!..but a great prob is the users online are not visibleā€¦though iā€™m receiving their presence ā€œavailableā€ā€¦it seems my code is not appropriateā€¦hereā€™s a snap of itā€¦eagerly waiting for replyā€¦

thanks in advanceā€¦

public void grabBuddyList()
{
Roster roster = connection.getRoster();
Collection entries = roster.getEntries();

        System.out.println("\n\n" + entries.size() + " buddies:");
        for(RosterEntry r:entries)
        {
        System.out.println(r.getUser());
        }
}

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