0

I am running an openfire server on the Amazon Web Services EC2 cloud and have written a little strophe.js powered xmpp client to connect to the server and send messages back and forth. This works fine.

However, I also want to do in-band registration (XEP-0077) with this client. For this, I am trying to use strophe.register.js.

Here is the code I use:

        var tempConn = new Strophe.Connection("http://myAWSDNS.compute.amazonaws.com:7070/http-bind/");
        tempConn.register.connect("http://myAWSDNS.us-west-2.compute.amazonaws.com/", function (status) {
        if (status === Strophe.Status.REGISTER) {
            // fill out the fields
            connection.register.fields.username = "juliet";
            connection.register.fields.password = "R0m30";
            // calling submit will continue the registration process
            connection.register.submit();
        } else if (status === Strophe.Status.REGISTERED) {
            console.log("registered!");
            // calling login will authenticate the registered JID.
            connection.authenticate();
        } 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
        }
    });

I have enabled in-band registration on the openfire server (see image)

However, I always get output: "The Server does not support In-Band Registration" (i.e., status === Strophe.Status.REGIFAIL.

I have stepped into strophe.register.js code, and see that it tries to find the register-tag in the <stream:features>, but cant find it, and sets the status to REGIFAIL then.

var register, mechanisms;
    register = bodyWrap.getElementsByTagName("register");
    mechanisms = bodyWrap.getElementsByTagName("mechanism");
if (register.length === 0) {
        that._changeConnectStatus(Strophe.Status.REGIFAIL, null);
        return;

This is the xml I get which contains stream features:

<body xmlns="http://jabber.org/protocol/httpbind" xmlns:stream="http://etherx.jabber.org/streams" from="win-lv4k7bsupjo" authid="747df9ee" sid="747df9ee" secure="true" requests="2" inactivity="30" polling="5" wait="60" hold="1" ack="913534085" 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><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"/><session xmlns="urn:ietf:params:xml:ns:xmpp-session"/></stream:features></body>

As you can see it contains a bunch of mechanisms, but no register part.

So, my question is: Why does it not contain a register tag, if I have enabled in-band registration, and, how can I set it to include this register tag, so I can do in-band registration?

Any help is appreciated!

Thanks,

best regards,

Chris

hansa
  • 1
  • 1

1 Answers1

0

Have you tried including http:// in your Strophe.Connection, the full URL + ":7070/http-bind/"

eg. Strophe.Connection("http://myAWSDNS.compute.amazonaws.com:7070/http-bind/")

and also comment out in strophe.register

/* if (register.length === 0) { that._changeConnectStatus(Strophe.Status.REGIFAIL, null); return; } else*/ this.enabled = true;

worked for me.

regards, Marinus

  • Hey Thanks for your repsone. Unfortunately your suggestions didnt make a difference. I`m not sure whether they should, either. Also, I don't think commenting out code is a good idea, as it is hopefully there for a purpose. Anyway, I also posted this on the openfire forums, and they have submitted this issue into their system as a bug. See https://igniterealtime.jiveon.com/thread/53467 and https://igniterealtime.org/issues/browse/OF-840 – hansa Sep 16 '14 at 22:12