I am building an XMPP chat app, I used strophe.js but I have no idea of how to change username and password with strophe. Thanks in advance.
Asked
Active
Viewed 384 times
1
-
1have you checked my answer? – beaver Feb 12 '18 at 07:50
1 Answers
1
You can't change username, because it is the JID, a unique identifier of the user, created on registration to your XMPP server.
On the contrary you can change the password according to xep-0077 - In-Band Registration.
Using Strophe.js the code is:
function setPwd(pwd) {
// jid is user account (i.e. myname@server.com)
// name is user name (i.e. myname), must be equal to first part of jid
var iq = $iq({
type: 'set',
to: jid,
}).c('query', {
xmlns: 'jabber:iq:register'
})
.c('username').t(name).up()
.c('password').t(pwd);
connection.sendIQ(iq, function(iq) {
console.log("setPwd-callback", iq);
});
}

beaver
- 17,333
- 2
- 40
- 66