How to register username password fields from sql in mongooseim server

512 views Asked by At

I have created 2 accounts in my localpc and then after I registered it with mongooseim. I am able to login mongooseim through converseJS client.

Now I want to login mongooseim from mysql tables fields(username, password), without creating new accounts in localpc, in short mongooseim should authenticate users from sql-database only.

2

There are 2 answers

0
Mickaël Rémond On

You should configure your server to use ejabberd database authentication.

This is done with module ejabberd_auth to work with odbc and choosing odbc type MySQL.

Please read, this part of the documentation: http://www.process-one.net/docs/ejabberd/guide_en.html#htoc25

3
cagrigunal On

After mongooseim 1.5.0 you can set up MySQL with Mongooseim with instructions below,

You should create database named ejabberd and then you should create your tables with mysql.sql

mysql -h localhost -p -u root

Enter your password

GRANT ALL ON ejabberd.* TO 'ejabberd'@'localhost'IDENTIFIED BY 'password';

CREATE DATABASE ejabberd;

Now exit from mysql

Recreate tables

mysql -D ejabberd -h localhost -p -u ejabberd < mysql.sql     

In the ejabberd.cfg comment out auth_method internal and activate auth_method odbc and then activate MySQL Server setup with your password

%% MySQL server:

%%

{odbc_server, {mysql, "localhost", 3306, "ejabberd", "ejabberd", "password"}}.