Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Page:  1  2  next
Avatar
Vincent #1
Member since Sep 2010 · 15 posts
Group memberships: Members
Show profile · Link to this post
Subject: Connecting to Facebook Chat using X-FACEBOOK-PLATFORM
Hi everyone,

I'm trying a accomplish a simple task, namely connecting to chat.facebook.com using the "X-FACEBOOK-PLATFORM" mechanism. When connecting to facebook it suggests both the MD5-DIGEST and the X-FACEBOOK-PLATFORM mechanism and continues to connect using the MD5-DIGEST. How do I set the mechanism type X-FACEBOOK-PLATFORM when connecting? Any hints or examples are greatly appreciated!

Thanks in advance,
Vincent
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hi Vincent,

what should be the advantage of using the X-FACEBOOK-PLATFORM Sasl mechanism for login? MatriX does not support this Sasl mechanism, so you can't use it.
Is this Sasl mechanism documented somewhere?

Alex
Avatar
Vincent #3
Member since Sep 2010 · 15 posts
Group memberships: Members
Show profile · Link to this post
hi Alex,

Using X-FACEBOOK-PLATFORM is required for me because it enables me to use the facebook connect method and avoids having to send the login/password. It's described here; http://developers.facebook.com/docs/chat#auth

Kind regards,
Vincent
Avatar
Alex #4
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I have an implementation of X-FACEBOOK-PLATFORM. But its in alpha stage and untested. Do you have some example code how to login to Facebook from c# and get the session key which is required for the Sasl mechanism?
Then I can test and release it.

Thanks
Avatar
Vincent #5
Member since Sep 2010 · 15 posts
Group memberships: Members
Show profile · Link to this post
Unfortunately I have no code ready to mail you right away. I have been using the Connect example from the Facebook Developer Toolkit to start a facebook session. I didn't get around to testing the session key for chat because I was stuck on the x-facebook-platform mechanism. To contruct a proper response to the auth request I had found this post on the facebook developer forum which I planned to try out:
http://forum.developers.facebook.net/viewtopic.…?pid=204…
Avatar
Alex #6
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I have the complete implementation of the X-FACEBOOK-PLATFORM developed from the documentation at Facebook. My understanding is that you have to create a app first you get and api_key and api_secret. What I need for testing is some c# code which logs in and gives me the session_key. Then these 3 parameters must be passed to MatriX.
I have downloaded a Facebook c# Api for connecting but the examples are not working :(.
Avatar
Vincent #7
Member since Sep 2010 · 15 posts
Group memberships: Members
Show profile · Link to this post
I do have an application key + secret for you which I used for testing.

private const string APPLICATION_KEY = "854eb7a912f81b479ac4f08d4639784f";
private const string SECRET_KEY = "51d57be004e337af3b7193f62fb0e47b";

You can then acquire the session_key by logging in after creating a new session.

ConnectSession _connectSession = new ConnectSession(APPLICATION_KEY, SECRET_KEY);

After a succesful login the session_key resides in _connectSession.SessionKey.

I hope this helps.
Avatar
Alex #8
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I have uploaded a new binary to http://www.ag-software.net/downloads.html.
How to use the X-FACEBOOK-PLATFORM authentication is described in the MatriX developer guide.
This post was edited on 2013-02-25, 22:31 by Alex.
Avatar
Vincent #9
Member since Sep 2010 · 15 posts
Group memberships: Members
Show profile · Link to this post
Wow, awesome support Alex. I will try this first thing tomorrow!
Avatar
Alex #10
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
i used the Facebook toolkit from here:
http://facebooktoolkit.codeplex.com

You have to add the missing enum value xmpp_login to Facebook.Schema.ExtendedPermissions. Then i use the following code to connect to Facebook and get the session key and ask for XMPP permission:

  1. facebookService1.ApplicationKey = "APPLICATION_KEY";
  2. facebookService1.ConnectToFacebook(new List<Enums.ExtendedPermissions>() { Enums.ExtendedPermissions.xmpp_login });
  3. string sessionKey = facebookService1.SessionKey;

Then pass the params to MatriX.

Alex
Avatar
Vincent #11
Member since Sep 2010 · 15 posts
Group memberships: Members
Show profile · Link to this post
After updating matrix I get an exception when trying to open a connection. It's a NullReferenceException which traces back to the following;

[NullReferenceException: Object reference not set to an instance of an object.]
Matrix.XmppStream.#=qhNHUj$CT_r9IhU9d7Eb0yA==() +49
Matrix.XmppStream.Open() +18
Matrix.Xmpp.Client.XmppClient.Open() +58

Did I neglect to properly set the xmppstream or is this something in the matrix api?
Avatar
Alex #12
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
There is a problem with the Dispatcher. Can you attach an example so that I can cause and debug the problem?
Or can you try to set a dispatcher manual?

Alex
Avatar
Alex #13
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
can you also post a full stacktrace?
Avatar
Alex #14
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
found a problem with the dispatcher in Console apps. Uploaded a new version. Can you give it a try again?

Alex
Avatar
Vincent #15
Member since Sep 2010 · 15 posts
Group memberships: Members
Show profile · Link to this post
The latest version is ok, the exception is gone. When authenticating with the facebook server all the params are filled but I get a not-authorized.  I added the xmpp_login enum to the Extended Permissions and feed this into the RequiredPermissions like so;
_connectSession = new ConnectSession(APPLICATION_KEY, SECRET_KEY);
_connectSession.RequiredPermissions = new List<Enums.ExtendedPermissions>() { Enums.ExtendedPermissions.xmpp_login };

How did you pass the extended parameter to facebook?
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:
Page:  1  2  next