Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
davidroyale #1
Member since Oct 2013 · 6 posts
Group memberships: Members
Show profile · Link to this post
Subject: NullReferenceException when connecting with X-FACEBOOK-PLATFORM
Hi,
im just testing the  X-FACEBOOK-PLATFORM authentication in a Windows Forms application. Everything works fine when im connecting with username/password, but SASL fails on connection attempt with a NullReferenceException. Please find my debug.xml attached.

- Ive included the latest sources from SVN in my project.
- xmpp_login permission is granted by facebook.
- Valid AccessToken is provided (graph-api calls are working)
- My TestCode looks similar to this one: http://forum.ag-software.net/thread/1446-Connecting-to-Fac…

It looks like the parameter "AccessToken" in method BuildResponse is null, all of sudden. Apikey is still set.

  1. <stream:stream to='chat.facebook.com' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xml:lang='en'>
  2.  
  3. <stream:stream xmlns:stream="http://etherx.jabber.org/streams" version="1.0" id="1" xml:lang="en" from="chat.facebook.com" >
  4.  
  5. <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>PLAIN</mechanism></mechanisms></stream:features>
  6.  
  7. <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  8.  
  9. <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  10.  
  11. <stream:stream to='chat.facebook.com' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xml:lang='en'>
  12.  
  13. <stream:stream xmlns:stream="http://etherx.jabber.org/streams" version="1.0" id="1" xml:lang="en" from="chat.facebook.com" >
  14.  
  15. <stream:features xmlns:stream="http://etherx.jabber.org/streams"><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>X-FACEBOOK-PLATFORM</mechanism><mechanism>PLAIN</mechanism></mechanisms></stream:features>
  16.  
  17. <auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="X-FACEBOOK-PLATFORM" />
  18.  
  19. <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dmVyc2lvbj0xJm1ldGhvZD1hdXRoLnhtcHBfbG9naW4mbm9uY2U9MDI5NjBDMzI5NDdFOTNDMzVCRjE1MUY1N0U1N0JFMTU=</challenge>

Exception: System.ArgumentNullException: Value cannot be null.
Parameter name: stringToEscape
   at System.Uri.EscapeDataString(String stringToEscape)
   at agsXMPP.Sasl.Facebook.FacebookMechanism.BuildResponse(Dictionary`2 pairs) in c:\Users\Administrator\Downloads\agsxmpp-20e543b91df27aa5099e1f2ad4b62316bb274a42\agsxmpp-20e543b91df27aa5099e1f2ad4b62316bb274a42\agsxmpp\Sasl\Facebook\FacebookMechanism.cs:line 121
   at agsXMPP.Sasl.Facebook.FacebookMechanism.Parse(Node e) in c:\Users\Administrator\Downloads\agsxmpp-20e543b91df27aa5099e1f2ad4b62316bb274a42\agsxmpp-20e543b91df27aa5099e1f2ad4b62316bb274a42\agsxmpp\Sasl\Facebook\FacebookMechanism.cs:line 56
   at agsXMPP.Sasl.SaslHandler.OnStreamElement(Object sender, Node e) in c:\Users\Administrator\Downloads\agsxmpp-20e543b91df27aa5099e1f2ad4b62316bb274a42\agsxmpp-20e543b91df27aa5099e1f2ad4b62316bb274a42\agsxmpp\Sasl\SaslHandler.cs:line 173
   at agsXMPP.Xml.StreamHandler.Invoke(Object sender, Node e)
   at agsXMPP.Xml.StreamParser.DoRaiseOnStreamElement(Element el) in c:\Users\Administrator\Downloads\agsxmpp-20e543b91df27aa5099e1f2ad4b62316bb274a42\agsxmpp-20e543b91df27aa5099e1f2ad4b62316bb274a42\agsxmpp\Xml\StreamParser.cs:line 362
This post was edited on 2013-10-24, 11:54 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you say you have the latest SVN sources. Can you please try to run with agsXMPP in debug and put a breakpoint to:

agsXMPP.Sasl.Facebook.FacebookMechanism.cs function BuildResponse()

your exception sais its crashing on line 121 with a System.ArgumentNullException: Value cannot be null.:
  1. res = res + "&call_id=" + System.Uri.EscapeDataString(callId);?

the CallId gets set when the class gets created:

  1. private readonly string callId = new Random().Next().ToString();

I see no reason why callId should be null.

Thanks,
Alex
Avatar
davidroyale #3
Member since Oct 2013 · 6 posts
Group memberships: Members
Show profile · Link to this post
Hi,
thanks for your reply. Im sorry but i deleted some blank lines so the line number does not match the SVN-codeline. Just downloaded the code again from SVN, the correct line is 119. AccessToken was null due to private signature.. sorry. But now im getting the following error (xml same as posted above). In public override void Parse(Node e), XmppClientConnection is null.

Exception: System.NullReferenceException: Object reference not set to an instance of an object.
   at agsXMPP.Sasl.Facebook.FacebookMechanism.Parse(Node e) in c:\DEV\....\Main\src\Frameworks\xmpp\Sasl\Facebook\FacebookMechanism.cs:line 58
   at agsXMPP.Sasl.SaslHandler.OnStreamElement(Object sender, Node e) in c:\DEV\....\Main\src\Frameworks\xmpp\Sasl\SaslHandler.cs:line 173
   at agsXMPP.Xml.StreamHandler.Invoke(Object sender, Node e)
   at agsXMPP.Xml.StreamParser.DoRaiseOnStreamElement(Element el) in c:\DEV\....\Main\src\Frameworks\xmpp\Xml\StreamParser.cs:line 362
This post was edited 2 times, last on 2013-10-24, 12:55 by davidroyale.
Avatar
Alex #4
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
no idea as well here, I see no reason why it should crash on line 58 when it was able to build the response. This is also not a full stacktrace, So I don't see which object is null.
Please try the SVN code without any modifications. When you have changed the codes then there is probably a problem in one of your changes.
Avatar
davidroyale #5
Member since Oct 2013 · 6 posts
Group memberships: Members
Show profile · Link to this post
In public override void Parse(Node e), XmppClientConnection is null.
Avatar
Alex #6
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I have committed a patch. Please get new code from SVN and try again.

Thanks
Avatar
davidroyale #7
Member since Oct 2013 · 6 posts
Group memberships: Members
Show profile · Link to this post
Thanks Alex, found the missing assignment in the Init()-Method on my own in the meantime ;)

Now im getting a "not authorized", altough ive granted the xmpp_login. Strange thing..

  1. <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">LONG CRYPTIC STRING HERE</response>
  2. <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized /></failure>
This post was edited 2 times, last on 2013-10-24, 13:13 by Alex.
Avatar
Alex #8
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
then either your facebook app is not configured correct, or something wrong with your token.
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: agsXMPP RSS