简体   繁体   中英

Use custom users table for eJabberd

Updated Answer

So I have a mobile app with registration and login working (with other features of course, but they are not important in this context). Now I want to add chat features to this application. I installed eJabberd, imported SQL script and enabled SQL. The resultant here is two users table, one that the app uses for registration and login, and another is one created by importing ejabberd script which ejabberdctrl registers its users by default.

Then I set up external authentication, which is using app users table (not one created by ejabberd).

Now my question is, with this setup that bypasses ejabberd users table, will the ejabberd server still work? I'm trying to think for example how will ejabberd organize account rosters when it does not know about app users table and its table is empty?

In other words, how can I tell ejabberd to use my custom app table for all users operations instead of its default table? I want to avoid having to insert data in two tables.

Old question (to preserve answers context)

I have a working ejabberd installation authenticating login with custom script. It works fine. But now am facing an issue, that's more of foreseen problem than actually encountered.

As of now I have users duplicated in ejabberd user table and custom user table. This means I will need to post data to my registration API as well ss ejabberd API. Is there a way to tell ejabberd to use certain table as users table in config? Or will it be safe if I just ignore users table and not register and user with ejabberd altogether? Will the rest of ejabberd work?

Regardless of what tables exist (or not) and what content they have, ejabberd will use only the one you define in auth_method, as mentioned in the Authentication documentation :

auth_method: internal

ejabberd will use the 'passwd' table in the Mnesia internal database.

auth_method: sql

ejabberd will use the 'users' table in the SQL database that you configured.

auth_method: external

ejabberd will use the extauth script.

auth_method: [sql, external]

ejabberd will first attempt to use sql. If that fails, it will use external. I don't know the details here, and found no documentation, fortunately you don't need to do this.

In other words, how can I tell ejabberd to use my custom app table for all users operations instead of its default table?

Now the answer is simple:

auth_method: external

I have a working ejabberd installation authenticating login with custom script.

What authentication method are you using, from the ones documented in https://docs.ejabberd.im/admin/configuration/authentication/ ?

Are you using "external"?

As of now I have users duplicated in ejabberd user table and custom user table.

How can that be? If you are using "external" authentication script, the account credentials (username+password) are not stored in ejabberd.

What is "ejabberd user table"? What is "custom user table"?

There is something misterious in your setup, that make impossible to help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM