REST API - can not create user which includes a '@' character in the jid node

Hi @Redeyes, I am successfully using the REST API for creating (Openfire 3.9.3) for creating users except the following case:

  • When I create a user which includes a @ in the user’s jid node then I get an error 500
    This is clearly supported by Openfire since the Web Admin Interface I can create a user like test@example.com@example.com (XEP 0106 in play here)

The POST request body which is failing is this:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<username>test3333@com.com</username>

p4ssword

The question here is whether I am doing something wrong (I have tried substituting @ with %40 but to no effect) here, or there is an issue why the url encoding of the jids. When setting the email value this works perfectly well, so this is something specific to Jid node.

Yes, you are right that is currently not possible to create a user with containing @ in username.

But its wrong to me, to create users with the username which contains @ (JID, Email format) because if your username is a JID your real JID

will be looking like that: testuser@test.com@testdomain.com/SomeRessource

According to XEP-0106: JID Escaping this is perfectly legal. Also OpenFire, supporting XEP0106, allows the creation of users with such node jids, from the Web Admin Tool. My business case also requires such Jids (or I will have to perform some mapping of emails to jid nodes…)

Having said that, offering XEP-0106 compatible support to the REST API would be great!

You are using the wrong escape character. Use \40 instead of %40. The old user service plugin did accept escaping. I create user names with embedded @ character all the time. For example, user\40company@myservice.net

1 Like

Correct for REST API. However I had a little trouble when using it with the PHP-Openfire REST-API class for PHP. The solution there was to escape also the , so the escape character for @, should be \40, for gidkom/php-openfire-restapi · GitHub