astro/node-xmpp — Issue #41: how to register a new account via node-xmpp
Author: minehp
Created: 2011-10-27 03:44:51+00:00
State: open

i read XEP-0077
if i wan to register i must send " iq " with get type, like:

the example above is XML , so i try to made it into json, like this :

ejabberd.send(new xmpp.Element('iq',{type:'get',id:'reg1',to:'test.server'}).c('query',{xmlns:'jabber:iq:register'}));

and i got result like this :

{ name: 'iq',
parent: null,
attrs:
{ from: 'admin@test.server',
to: 'admin@test.server/38928777511319686566520895',
id: 'reg1',
type: 'result',
xmlns: 'jabber:client',
'xmlns:stream': 'http://etherx.jabber.org/streams' },
children:
[ { name: 'query',
parent: [Circular],
attrs: [Object],
children: [Object] } ] }

with children like :

[ { name: 'instructions',
parent:
{ name: 'query',
parent: [Object],
attrs: [Object],
children: [Circular] },
attrs: {},
children: [ 'Choose a username and password to register with this server' ] },
{ name: 'username',
parent:
{ name: 'query',
parent: [Object],
attrs: [Object],
children: [Circular] },
attrs: {},
children: [ 'admin' ] },
{ name: 'password',
parent:
{ name: 'query',
parent: [Object],
attrs: [Object],
children: [Circular] },
attrs: {},
children: [] },
{ name: 'registered',
parent:
{ name: 'query',
parent: [Object],
attrs: [Object],
children: [Circular] },
attrs: {},
children: [] } ]

adn then i send this code ( like XEP-0077 example ) :

ejabberd.send(new xmpp.Element('iq',{type:'set',id:'reg1'}).c('query',{xmlns:'jabber:iq:register'}).c('username').t('alow').up().c('password').t('testa'));

why i got error result like this

[ { name: 'query',
parent:
{ name: 'iq',
parent: null,
attrs: [Object],
children: [Circular] },
attrs: { xmlns: 'jabber:iq:register' },
children: [ [Object], [Object] ] },
{ name: 'error',
parent:
{ name: 'iq',
parent: null,
attrs: [Object],
children: [Circular] },
attrs: { code: '403', type: 'auth' },
children: [ [Object] ] } ]

what i miss something....?
i already used super user in all code...