Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable create users for authentication using Postgres in emqx #1969

Open
Suryaobulareddy2932 opened this issue Oct 26, 2023 · 1 comment
Open
Assignees
Labels
help wanted Extra attention is needed

Comments

@Suryaobulareddy2932
Copy link

Hello,

I'm using postgres as authenicator and authorization in emqx (V5.3). When I tried to add a user by using below curl command, it was giving me bad request. For your reference, I'm attaching the request and response

Request:

curl --location 'http://localhost:18083/api/v5/authentication/password_based:postgresql/users' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic <token>' \
--data '{
  "password": "12345678",
  "user_id": "user4"
}'

Response:
code: 400

{
    "code": "BAD_REQUEST",
    "message": "User error: unsupported_operation"
}

FYI,

  1. I have tried by inserting the values into db into their respective table. It is working as intended.
  2. I have used above curl command by changing the authenicator id to in-built-database. It also worked for me.

But with postgresql I'm getting the above error

If anyone is aware of this issue, please help me out

Thanks

@ysfscream ysfscream self-assigned this Oct 30, 2023
@ysfscream
Copy link
Member

Hello,

First, thank you for providing detailed information and the steps you've tried. Based on your description, I understand you are trying to add a user via the EMQX API, utilizing PostgreSQL for authentication and authorization.

From the error information you provided, it seems that the response is a 400 Bad Request, and the error message is "User error: unsupported_operation." This implies that EMQX does not support this operation via the API.

You've already mentioned that when you insert user information directly into the database, the system works as intended. Similarly, when you change the authenticator ID to the built-in database, adding a user via the API also works. This indicates that EMQX supports managing users in the built-in database via the API but does not support managing users in an external PostgreSQL database.

As per the link you provided, you can view the Swagger documentation at http://localhost:18083/api-docs/index.html or refer to the EMQX development documentation for more information on using the API. Additionally, you can perform operations via the EMQX Dashboard and view detailed API request information through the Network tab in the browser’s developer tools (usually opened with the F12 key). This might help you better understand the workings and data structures of the API.

In conclusion, for your current issue, I recommend you continue adding users by directly inserting user information into the PostgreSQL database. If you need to manage users via the API, you might need to consider using EMQX’s built-in user management system.

I hope this information is helpful to you! If you have any other questions or need any more help, please don't hesitate to let me know.

@ysfscream ysfscream added the help wanted Extra attention is needed label Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants