We have a .NET 6.0 web application that uses the Okta.Sdk to create and modify users in our Okta organization
Below is a snipit of code we use for creating users
This works using the Okta.Sdk 6.0.11 version
public async Task<User> CreateUserAsync(string firstName, string lastName, string emailAddr, string username, string password)
{
var userType = await _userTypeApi.ListUserTypes().FirstOrDefaultAsync(x => x.Name == "usertypename");
var user = await _userApi.CreateUserAsync(new Okta.Sdk.Model.CreateUserRequest
{
Type = userType,
Profile = new Okta.Sdk.Model.UserProfile
{
Email = emailAddr,
FirstName = firstName,
LastName = lastName,
Login = username
},
Credentials = new Okta.Sdk.Model.UserCredentials
{
Password = new Okta.Sdk.Model.PasswordCredential
{
Value = password,
}
}
});
return user;
}
When we update to Okta.Sdk 7.0.0 we get an error
errorSummary: The request body was not well-formed.
After doing some debugging, it seems the serialization of UserType has changed to where it’s now serializing _links and not id
Does anyone have thoughts on this? Or is there a better way of creating a user with a specific type?