Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
mtranda #1
Member since Oct 2011 · 7 posts
Group memberships: Members
Show profile · Link to this post
Subject: Facebook chat (via X-FACEBOOK) stopped working
First of all, hello.

Long story short: facebook chat used to work and now it doesn't. The problem is that although we login just fine, obtain the token and perform the authentication mechanism, the roster doesn't get populated anymore. Or to be more precise, nothing happens on OnItem. We've tested older versions of the product (that we know for certain that they used to work) and we are fairly confident that it may be a problem on facebook's side (as they're no strangers to breaking their APIs). However, I was wondering if anyone over here has encountered this issue as well.

If you've read this far, then thank you for at least reading my post.
Avatar
Alex #2
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by mtranda:
and we are fairly confident that it may be a problem on facebook's side (as they're no strangers to breaking their APIs). However, I was wondering if anyone over here has encountered this issue as well.

yes they don't care about backwards compatibility which is very sad.
They have announced the breaking changes here:
http://developers.facebook.com/blog/post/555/

see also the discussion we had here:
http://forum.ag-software.de/thread/1189-Facebook-announce-…

I have added the new OAUTH parameters to the latest build which you can download here:
http://www.ag-software.net/download-directory/

But my understanding is that OAUTH is additional supported and optional. The only change I can see is that the require TLS now in order to use X-FACEBOOK-PLATFORM SASL mechanism.

Alex
Avatar
mtranda #3
Member since Oct 2011 · 7 posts
Group memberships: Members
Show profile · Link to this post
Hi Alex and thanks for the quick reply.

So on my end what changes would I need to make, exactly? Currently I'm already using access_token over SSL but the TLS bit I have no idea about.

edit: already downloaded the new DLL version.
Avatar
Alex #4
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
When you are already using Tls/Ssl it should work. So please post a complete XML log.
Then I can check what's going wrong.

Alex
Avatar
mtranda #5
Member since Oct 2011 · 7 posts
Group memberships: Members
Show profile · Link to this post
I'm logging everything through OnXML. This is all I get:

<stream:stream xmlns:stream="http://etherx.jabber.org/streams" id="7BE665B4" from="chat.facebook.com" version="1.0" xmlns="jabber:client" xml:lang="en" ><stream:features xmlns:stream="http://etherx.jabber.org/streams">
  <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
    <mechanism>X-FACEBOOK-PLATFORM</mechanism>
    <mechanism>DIGEST-MD5</mechanism>
  </mechanisms>
</stream:features><proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" /><stream:stream xmlns:stream="http://etherx.jabber.org/streams" id="64FFA3C5" from="chat.facebook.com" version="1.0" xmlns="jabber:client" lang="en" ><stream:features xmlns:stream="http://etherx.jabber.org/streams">
  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
    <mechanism>X-FACEBOOK-PLATFORM</mechanism>
    <mechanism>DIGEST-MD5</mechanism>
  </mechanisms>
</stream:features><challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dmVyc2lvbj0xJm1ldGhvZD1hdXRoLnhtcHBfbG9naW4mbm9uY2U9MDVGRkVCRTUyOTU3NDc0QTI5RTFEMkE1NTI4Q0EwODk=</challenge>

edit: as I said, nothing actually goes wrong. No exceptions occur, the token is retrieved, XmppClient.Open() works just fine. However, the roster fails to be retrieved.
This post was edited on 2011-10-14, 14:53 by mtranda.
Avatar
Alex #6
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
This is not the complete XML. I need incoming and outgoing xml.
See: http://www.ag-software.net/matrix.-xmpp-sdk/matrix-develop…

Alex
Avatar
mtranda #7
Member since Oct 2011 · 7 posts
Group memberships: Members
Show profile · Link to this post
Sorry about that. Realised afterwards that I'm not logging the sent XML.



[SENT]
<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="chat.facebook.com" version="1.0" >
[/SENT]

[RECEIVED]
<stream:stream xmlns:stream="http://etherx.jabber.org/streams" id="B337C55C" from="chat.facebook.com" version="1.0" xmlns="jabber:client" xml:lang="en" >
[/RECEIVED]

[RECEIVED]
<stream:features xmlns:stream="http://etherx.jabber.org/streams">
  <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
    <mechanism>X-FACEBOOK-PLATFORM</mechanism>
    <mechanism>DIGEST-MD5</mechanism>
  </mechanisms>
</stream:features>
[/RECEIVED]

[SENT]
<starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
[/SENT]

[RECEIVED]
<proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
[/RECEIVED]

[SENT]
<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="chat.facebook.com" version="1.0" >
[/SENT]

[RECEIVED]
<stream:stream xmlns:stream="http://etherx.jabber.org/streams" id="F3D96832" from="chat.facebook.com" version="1.0" xmlns="jabber:client" lang="en" >
[/RECEIVED]

[RECEIVED]
<stream:features xmlns:stream="http://etherx.jabber.org/streams">
  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
    <mechanism>X-FACEBOOK-PLATFORM</mechanism>
    <mechanism>DIGEST-MD5</mechanism>
  </mechanisms>
</stream:features>
[/RECEIVED]

[SENT]
<auth mechanism="X-FACEBOOK-PLATFORM" xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
[/SENT]

[RECEIVED]
<challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dmVyc2lvbj0xJm1ldGhvZD1hdXRoLnhtcHBfbG9naW4mbm9uY2U9QTY2Qzg3MzBBMDJFNDcyNDA1MkVGREVCQkI1REMxQTM=</challenge>
[/RECEIVED]
Avatar
Alex #8
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
It looks like MatriX stops when receiving your challenge. I try to debug this and see whats going wrong.

Alex
Avatar
Alex #9
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>.....</response>

I debugged this challenge in MatriX and see no errors. AFter teh <challenge/> MatriX should send a <response/> element for authentication.

Do you pass the new AccessToken propery?

From: http://developers.facebook.com/blog/post/555/

To enable XMPP developers to migrate to OAuth2.0 we are today announcing support for OAuth 2.0 with XMPP. With the new changes you do not need to use the session_key and sig parameters anymore and instead should use the access_token parameter which takes the access_token obtained when the user logs into Facebook with the xmpp_login extended permission. Note that this needs to be over SSL or you will get an error.

can you send us a basic example which tries to authenticate to your Facebook app to cause your problem?

Alex
Avatar
mtranda #10
Member since Oct 2011 · 7 posts
Group memberships: Members
Show profile · Link to this post
Hello Alex. Briefly put, this is what the facebook login looks like:

private void xmppClient_OnBeforeSasl(object sender, Matrix.Xmpp.Sasl.SaslEventArgs e)
        {
            e.Auto = false;
            e.SaslMechanism = Matrix.Xmpp.Sasl.SaslMechanism.X_FACEBOOK_PLATFORM;
            string key = AccessTokenHandler.GetSessionKey(accessT);            //Our facebook login/permission request implementation.
            e.SaslProperties = new Matrix.Xmpp.Sasl.Processor.Facebook.FacebookProperties
            {
                ApiKey = API_KEY,
                ApiSecret = API_SECRET,
                SessionKey = key               
            };
        }

As I said, in terms of permissions everything seems to work fine. The facebook login/permission request dialogs show up, we get the session key and we don't get any authentication errors from Matrix.

Also, I've tried assigning the session key an invalid key (generated locally) to see if I get a login error and indeed matrix does report the login error so what I retrieve from facebook seems to be correct.
Avatar
Alex #11
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
in the log you posted MatriX never responded to the challenge of your server, or you did not post the complete Xml log.
To me it makes no sense that you get an error when you generate a dummy session_key, but no success or error response with the real key. Please check again if you have posted the complete log.

And you are not using the new XMPP OAUTH, because you don't set the access_token in MatriX and still use the "old" session key.

Use the following:
  1. private void xmppClient_OnBeforeSasl(object sender, Matrix.Xmpp.Sasl.SaslEventArgs e)
  2. {
  3.     e.Auto = false;
  4.     e.SaslMechanism = Matrix.Xmpp.Sasl.SaslMechanism.X_FACEBOOK_PLATFORM;
  5.     e.SaslProperties = new Matrix.Xmpp.Sasl.Processor.Facebook.FacebookProperties
  6.     {
  7.         ApiKey = API_KEY,
  8.         ApiSecret = API_SECRET,
  9.         AccessToken = your_access_tokem
  10.     };
  11. }

Alex
Avatar
mtranda #12
Member since Oct 2011 · 7 posts
Group memberships: Members
Show profile · Link to this post
Thanks a lot! So all I had to do was pass the access token to Matrix instead of how I previously used to get the session key myself with the access token. So basically all that needed changing was a single line of code ;)

Everything works again.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: MatriX RSS