Auth0 Home Blog Docs

Get user by id doesn't return given_name and family_name


#1

I need to get the user information from auth0. When I put fields given_name and family_name in the field list I got error

ManagementAPI mgmt = new ManagementAPI("domain", "token");
UserFilter userFilter = new UserFilter();
userFilter.withSearchEngine("v3")
                .withFields("email,username,user_id,name,nickname,blocked, given_name,family_name", true);
Request<User> clientRequest = mgmt.users().get(userId, userFilter);
User execute = clientRequest.execute();

Query validation error: ‘String ‘email,username,user_id,name,nickname,blocked,given_name,family_name’ does not match pattern. Must be a comma separated list of the following values: phone_number,email,email_verified,picture,username,user_id,name,nickname,created_at,identities,app_metadata,user_metadata,last_ip,last_login,logins_count,updated_at,blocked’ on property fields (A comma separated list of fields to include or exclude (depending on include_fields) from the result, empty to retrieve all fields).

When I put all fields form the given list in the field list in response in User object fields “givenName” and “familyName” is null. But field “name” has value.

How I can get the given_name and family_name separately?

I asked this question on github (https://github.com/auth0/auth0-java/issues/177) and got the answer:

This is not an issue or a limitation of this SDK but from the API itself. I’ve commented this internally but I suggest you fill a ticket through https://support.auth0.com. Thanks for the report