I want to create a nodejs endpoint to get list of all users that are registered in the ejabberd server.
Create a nodejs endpoint that list all users in the ejjaberd. please help me to provide a right pathway to get this endpoint
I want to create a nodejs endpoint to get list of all users that are registered in the ejabberd server.
Create a nodejs endpoint that list all users in the ejjaberd. please help me to provide a right pathway to get this endpoint
On
So the issue you may be referring to is that you have a direct 'root level' API from Ejabberd to access such things but you want to expose your own Node.js API endpoint to your client app(s) to share this information in a more secure way.
The way we have done it in our project is we use Ejabberd API like mentioned in the answer by cisiqo here which we do from our Node.js application. In AWS security policies we ensure that only our Node.js application can use the Ejabberd server API.
Then we expose our own Node.js API to the world (client apps) under JWT authentication where we provide the users information etc without exposing other ejabberd APIs.
Does this help? We are thinking to make our server open source, we can share some code snippets if it helps anyway.
I depends on what you want to achieve in your business logic too. In our case we also needed an easy way for React Native and React.js clients to obtain a list of users for a given MUC room for example to display the list of participants in chat details screen and Ejabberd doesn't offer any easy way to do that. So we ended up writing our own plugin for Ejabberd which writes into MySQL table the list of participants for each room and then we expose that via our API.
You can read the docs from ejabberd. Ejabberd docs provider some APIs, the registered-users api maybe can help you.