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

Return user id for REST API user register #1730

Closed
2 tasks done
martin-etchart opened this issue Jun 17, 2020 · 2 comments · Fixed by #1929
Closed
2 tasks done

Return user id for REST API user register #1730

martin-etchart opened this issue Jun 17, 2020 · 2 comments · Fixed by #1929
Labels
enhancement New feature or request

Comments

@martin-etchart
Copy link
Contributor

martin-etchart commented Jun 17, 2020

My actions before raising this issue

Return user id on user creation/register with REST API

Expected Behaviour

When creating a user via de REST API it would be nice to have the user id returned on the response body.

Current Behaviour

Currently there is a "key" returned in the response body. Couldn't find in the docs what does that is.

Possible Solution

Add user id to the response body.

Context

When creating users we need to get the user ids so we can call the patch and set the permission groups for that user. Currently the only way to do that is by getting all the users list and searching that list by username.

Your Environment

  • Git hash commit (git log -1): 47470b84703bfc7bee243b2e7c1ae830ad587885
  • Docker version docker version : Docker 19.03.8
  • Are you using Docker Swarm or Kubernetes? No
  • Operating System and version (e.g. Linux, Windows, MacOS): MacOS Mojave
  • Code example or link to GitHub repo or gist to reproduce problem:
    Register test_user:
curl -X POST "http://localhost:8080/api/v1/auth/register" -H "accept: application/json" -H "Content-Type: application/json" -H "X-CSRFToken: tyzEYPiKULyv7ctbirrDtRhVLUDLizrZ7SXNdDyBMANNrrBE2bXPihMevi2K0UZI" -d "{ \"username\": \"test_user\", \"password1\": \"hash8080\", \"password2\": \"hash8080\"}"

Example response body:

{
  "key": "db2e1b4b43630224a0a8b032a72dccabfb2466b8"
}

Next steps

You may join our Gitter channel for community support.

@azhavoro azhavoro added the enhancement New feature or request label Jun 18, 2020
@martin-etchart
Copy link
Contributor Author

Maybe not just the id but similarly to a new task creation, the full object of the created user could be returned.

@inverniz
Copy link

Hi, I was wondering if this issue has really been closed? I see it is associated to a pull request with a different subject, and by printing the output of the auth/register API call it doesn't seem like the user_id is returned. Looking at the source code here I get the same impression. Thank you for your answer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants