Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
brent_r #1
Member since Aug 2011 · 4 posts
Group memberships: Members
Show profile · Link to this post
Subject: authentication issue
Have there been any issues with authentication for presence and messaging?  It looks like I can authenticate to my jabber server, but every other action fails with a 401 error message -- see debug output below:

<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="jabber.***" version="1.0" >
<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="jabber.***" version="1.0" id="93843e48" >
<stream:features xmlns:stream="http://etherx.jabber.org/streams">
  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
    <mechanism>DIGEST-MD5</mechanism>
    <mechanism>PLAIN</mechanism>
    <mechanism>CRAM-MD5</mechanism>
  </mechanisms>
  <compression xmlns="http://jabber.org/features/compress">
    <method>zlib</method>
  </compression>
  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind" />
  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
</stream:features>
<auth mechanism="DIGEST-MD5" xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
<challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl"> *** </challenge>
<response xmlns="urn:ietf:params:xml:ns:xmpp-sasl"> ***</response>
<success xmlns="urn:ietf:params:xml:ns:xmpp-sasl"> ***</success>
OnLogin
<presence type="subscribe" to="matrixtester102@jabber.***" id="MX_1" xmlns="jabber:client" />
<message to="matrixtester102@jabber.***" type="chat" xmlns="jabber:client">
  <body>hello there</body>
</message>
<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="jabber.***" version="1.0" >
<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="jabber.***" version="1.0" id="93843e48" >
<stream:features xmlns:stream="http://etherx.jabber.org/streams">
  <compression xmlns="http://jabber.org/features/compress">
    <method>zlib</method>
  </compression>
  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind" />
  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
</stream:features>
<iq id="MX_2" type="set" xmlns="jabber:client">
  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
    <resource>Matrix Windows Phone</resource>
  </bind>
</iq>
<presence type="error" to="jabber.***/93843e48" id="MX_1" xmlns="http://jabber.org/protocol/httpbind">
  <error code="401" type="auth">
    <not-authorized xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  </error>
</presence>
<message to="jabber.***/93843e48" type="error" xmlns="http://jabber.org/protocol/httpbind">
  <body>hello there</body>
  <error code="401" type="auth">
    <not-authorized xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  </error>
</message>
<iq type="result" id="MX_2" to="jabber.***/93843e48" xmlns="http://jabber.org/protocol/httpbind">
  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
    <jid>matrixtester101@jabber.***/Matrix Windows Phone</jid>
  </bind>
</iq>
Avatar
Alex #2
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
You send a presence and message directly in the OnLogin event when the Xmpp Session is not ready for use. This should cause your problems. You should wait until MatriX fetched your roster (OnRosterEnd) on your got the first OnPresence event.

Alex
Avatar
brent_r #3
Member since Aug 2011 · 4 posts
Group memberships: Members
Show profile · Link to this post
Thank you for the prompt reply!  I removed the method calls from OnLogin and the errors went away.  One more question -- following the book XMPP: The Definitive Guide, I am trying to create the simplest possible client based on MiniClientWP that just subscribes to one contact and then sends a test message.  Here is the sequence of my calls -- please let me know what I'm doing wrong (I'm not seeing any presence stanzas or OnRosterEnd activity). 

in cmdConnect_Click, I added xmppClient.AutoRoster = true  (so this should collect my roster info after login)

in the xmppClient_OnRosterEnd method, I added the following code: 
var pm = new PresenceManager(xmppClient);
            string sub_id = "matrixtester102@jabber.****";
            Jid jid = sub_id;
            pm.Subscribe(jid);

Nothing shows up in the ListBox for contacts, and OnRosterEnd never seems to be called.
Avatar
Alex #4
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you should first add the contact with the RosterManager and then subscribe to it.

When you add a new contact, update a contact or remove a contact during your session then the OnRosterItem event is called, without OnRosterStart before and OnRosterEnd after. The OnRosterStart and OnRosterEnd events are raised only during the login process when MatriX receives your complete roster. Because you can have a unlimited number of contacts this events are useful to speed up your ui and not update the UI after each new contact.

Alex
Avatar
brent_r #5
Member since Aug 2011 · 4 posts
Group memberships: Members
Show profile · Link to this post
So I believe I have found the problem why I was not receiving the OnRoster event, and no OnBind event either; it is the same problem that another poster in this forum found with BOSH, see http://forum.ag-software.de/thread/969-Connection-via-Bosh….  I am using a public Openfire server, and in the bind stanza from the server, there is the wrong namespace, http://jabber.org/protocol/httpbind, instead of jabber:client:

<iq type="result" id="MX_1" to="jabber.***/ab632282" xmlns="http://jabber.org/protocol/httpbind">
  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
    <jid>matrixtester101@jabber.****/Matrix Windows Phone</jid>
  </bind>
</iq>

Could someone please recommend a public XMPP server that has an updated version of Openfire etc. with this problem corrected?  Thanks!
Avatar
Alex #6
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
You can download the Mango version and use sockets.
Mango is coming soon to all WP7 users and brings you also some other useful features for IM software.
Or do you rely on Bosh?

Sorry but I don't know a public service running Bosh. Most XMPP services on the web supports only sockets.
You can download the latest Openfire version and install it locally or on a server yourself.

Alex
This post was edited on 2011-09-03, 11:54 by Alex.
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