-
Notifications
You must be signed in to change notification settings - Fork 133
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
Add ability to set only certain properties when updating a user. #58
Comments
@brettcooper The server won't let you call that endpoint sending any of those attributes. When you call PATCH you just send the attributes that you want to change, not the whole user object.. In the practice you'd do that if the Http method is PUT. So if you're trying to change the blocked attribute, just send that. |
@lbalmaceda Is it currently possible to do this with the Auth0 Java client? If so, can you point me in the right direction or can you provide an example? |
User should have a public constructor with no args but it seems it's missing. Anyway, if you see the code the same can be achieved by passing a null connection. ManagementAPI managementAPI = new ManagementAPI("the_domain","the_api_token");
User user = new User(null);
user.setBlocked(true);
managementAPI.users().update("your_user_id", user).execute(); |
Perfect. Thanks @lbalmaceda ! |
When calling the management API to update a user, I am always receiving the following exception:
com.auth0.exception.APIException: Request failed with status code 400: Payload validation error: 'Additional properties not allowed: logins_count,last_login,identities,updated_at,created_at,nickname,name,picture,user_id (consider storing them in app_metadata or user_metadata. See "Users Metadata" in https://auth0.com/docs/api/v2/changes for more details)'.
According to the Auth0 API documentation, it looks like we should only be sending properties for the user that have changed (e.g. - email, email_verified, user_metadata, etc.) But, with the current API's implementation, this is not possible and I have had to write my own REST call to make this work (I am just trying to update a user so that user is blocked).
Something similar to this should work:
The text was updated successfully, but these errors were encountered: