powered by Jive Software

Strophe.js in-band registration to Openfire Server: registration works, subsequent authentication fails

have some fairly simple code that relies on strophe.js and strophe.register.js.

I am using this code for in-band registration, and basically following the example at https://github.com/strophe/strophejs-plugins/tree/master/register. I want to create an account (which works, I can see the new user on the server), and then log in to that account directly, without having to reenter the jid and password. For this, the authenticate method should work, as far as I understand. However, the authentication is not working, for some reason.

Here is my code:

$(document).bind('SignUp', function (ev, data) {
var SignUpConn = new Strophe.Connection("http://myAWSDNS.com:7070/http-bind/"); 

  SignUpConn.register.connect("myAWSDNS.com", function (status) {
  if (status === Strophe.Status.REGISTER) {
  SignUpConn.register.fields.username = data.name;
  SignUpConn.register.fields.name = data.name;
  SignUpConn.register.fields.password = data.password;
  SignUpConn.register.fields.email = data.jid;
  // calling submit will continue the registration process
  SignUpConn.register.submit();
  } else if (status === Strophe.Status.REGISTERED) {
  SignUpConn.register.authenticate(); //gives an error 
  } else if (status === Strophe.Status.CONFLICT) {
  console.log("Contact already existed!");
  } else if (status === Strophe.Status.NOTACCEPTABLE) {
  console.log("Registration form not properly filled out.")
  } else if (status === Strophe.Status.REGIFAIL) {
  console.log("The Server does not support In-Band Registration")
  } else if (status === Strophe.Status.CONNECTED) {
  // do something after successful authentication
  } else {
  // Do other stuff
  }
  });
});

It seems that the authentication, in the REGISTERED bracket, is not working. To show this, here are the xmpp stanzas I get back from the server during this processL:

<body xmlns="http://jabber.org/protocol/httpbind" xmlns:stream="http://etherx.jabber.org/streams" from="myAWSDNS.com" authid="afe3be9a" sid="afe3be9a" secure="true" requests="2" inactivity="30" polling="5" wait="60" hold="1" ack="442592894" maxpause="300" ver="1.6"><stream:features><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>DIGEST-MD5</mechanism><mechanism>PLAIN</mechanism><mechanism>ANONYMOUS</mechanism><mechanism>CRAM-MD5</mechanism></mechanisms><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><register xmlns="http://jabber.org/features/iq-register"/><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"/><session xmlns="urn:ietf:params:xml:ns:xmpp-session"/></stream:features></body>

<body xmlns='http://jabber.org/protocol/httpbind'><iq xmlns="jabber:client" type="result"><query xmlns="jabber:iq:register"><username/><password/><email/><name/><x xmlns="jabber:x:data" type="form"><title>XMPP Client Registration</title><instructions>Please provide the following information</instructions><field var="FORM_TYPE" type="hidden"><value>jabber:iq:register</value></field><field var="username" type="text-single" label="Username"><required/></field><field var="name" type="text-single" label="Full name"/><field var="email" type="text-single" label="Email"/><field var="password" type="text-private" label="Password"><required/></field></x></query></iq></body><body xmlns='http://jabber.org/protocol/httpbind'><iq xmlns="jabber:client" type="result" to="ec2-54-68-231-144.us-west-2.compute.amazonaws.com/afe3be9a"/></body>

<body xmlns='http://jabber.org/protocol/httpbind'><iq xmlns="jabber:client" type="result" to="myAWSDNS.com/afe3be9a"/></body>

<body xmlns='http://jabber.org/protocol/httpbind'><challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cmVhbG09ImVjMi01NC02OC0yMzEtMTQ0LnVzLXdlc3QtMi5jb21wdXRlLmFtYXpvbmF3cy5jb20iLG5vbmNlPSIzYzRaZ2Y1bWtPTmVmU3hSR29KK3ZEdHEyM0NQdW9rMDErR3I0dkFiIixxb3A9ImF1dGgiLGNoYXJzZXQ9dXRmLTgsYWxnb3JpdGhtPW1kNS1zZXNz</challenge></body>

<body xmlns='http://jabber.org/protocol/httpbind'><failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure></body>

Since I am not a complete xmpp expert yet, I am not completely sure about what the 4th stanza including the challenge means, but I think it has something to do with authentication.

Anyway, the 5th and last stanza inidicates a failure in the authentication due to <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure>.

I am not sure why this is not working, and am not sure if this is an issue in the code I am using, or whether it is a Server settings issue.

The server I am using is Openfire 3.10.0 alpha, specifically this nightly build, as it has a bug fix I need:https://www.igniterealtime.org/builds/openfire/dailybuilds/openfire_2014-09-17.t ar.gz

Thanks and best regards,

Chris