Nerzal/gocloak

userID does not update even after passing ID in User struct

shubhamUpadhyayInBlue opened this issue · 1 comments

Describe the bug
The userID does not update even after passing ID in the user struct, here.

       user := gocloak.User{
		ID:            gocloak.StringP(data.MsgData.OrgID)

To Reproduce
Steps to reproduce the behavior:

  1. Run keycloak server using docker image - https://quay.io/repository/keycloak/keycloak?tab=tags&tag=latest
  2. Now use the gocloak library v13.7.0
  3. Send data to create new user and pass a custom userID to the ID field of User struct
  4. The user is created but not with the custom ID of the user but an auto-generated UUID.

Expected behavior

  1. Since ID is provided in the User struct it should update the user_id but it does not.

Screenshots
Screenshot 2023-08-03 at 12 28 59 PM
Screenshot 2023-08-03 at 12 30 23 PM

Desktop (please complete the following information):
N.A.

Smartphone (please complete the following information):
N.A.

Additional context
I also found an article that says that keycloak does not allow custom userid, but since it was being accepted in the user struct of this library I tried to update it but doesn't look like it works.

Nerzal commented

The library is a wrapper around the keycloak API.
The models used in Gocloak match the models provided in the Keycloak API Documentation.

Some (lots) of these models hold more fields, than used/filled by the Keycloak API.
I guess it would be a good idea for the future to clean them up a bit, to match what they actually do.