Creating User in Okta

Hi Team,

I am using Spring Boot to connect to Okta Server.
I am using below OKTA SDK API to store create user.
User user = client.createuser(CreateUserRequest request);

My problem is I am not able to create instance for CreateUserRequest as it is an interface and the implementation class not available in that dependency.
I am posting here this question to know that, is there any sample reference available for building the CreateUserRequest object.

Thank you

Does the example code snippet work for you?

UserApi userApi = new UserApi(client);
User user = UserBuilder.instance()
.setEmail(β€œjoe.coder@example.com”)
.setFirstName(β€œJoe”)
.setLastName(β€œCode”)
.buildAndCreate(userApi);

1 Like

Thank you so much your response.

Code snippet you shared was really helpful.I have already implemented this. But I am stuck with one issue.

When I try to call createUser method, the method is expecting createrequest object as a parameter. This is an interface. I tried to create implementation and tried to set the data, but it is not allowing me to do that.

Requesting you to help me on this.