I am currently trying to add chat functionality with MongooseIM to an app that already comes with users/accounts.

The idea was to add a mongooseIM chat server and register all existing (and future) users with their user ID in mongooseIM.

Setup

I am working with the mongooseIM docker container and have set up a docker compose that loads custom configuration.

In the custom configuration, I have added the admin REST API and can do requests like listing all registered users or the available commands.

Problem

Whenever a new user should be registered through the API, I get the response: Can't register user at node: not_allowed and a 500 status code.

Trying to register a user through mongooseimctl returns Error: account_unprivileged.

What I tried

I think I have been reading through the documentation and google results for about 6 hours by now.

Testing with the standard docker container (and no extra configuration) works from the command line, but I failed testing the API because I do not know how to access the API then (or if it is enabled at all). Maybe someone has a hint on this for me?

One idea was that the action really is not allowed, but the /commands route of the admin interface contains the register_user action in the results, so I think its enabled/allowed:

  %{
    "action" => "create",
    "category" => "users",
    "desc" => "Register a user",
    "name" => "register_user"
  },

When using the default docker container and trying to register a user for a non-existent domain also results in "not_allowed", so this could be a configuration problem. I have a host name configured in my mongooseim.toml config file:

[general]
  loglevel = "warning"
  hosts = ["myhost"]
  default_server_domain = "myhost"
  language = "en"

I am quite positive I am missing some configuration/setup somewhere and would appreciate any hints/help.

Edit 1

I added dummy authorization (== no authorization) to the config file:

[auth]
  methods = ["dummy"]

Now, I no longer get a "not_allowed" error.

Instead, the response always states the user already exists, while requesting the user list always returns an empty list.

I tried sending messages between made-up user jids, i get no errors, but also no messages are returned for any users.

1

There are 1 best solutions below

0
arcusfelis On

"dummy" method is for testing only. It makes any user to exist (check ejabberd_auth_dummy.erl code, it is really just a dummy without any implementation). You should use internal or rdbms auth_methods instead. rdbms method would need an rdbms connection configured. internal method is used to store users in Mnesia (but Mnesia backends are not recommended because RDBMS just works more reliably and efficiently).