We are implementing a feature that allows a user to update their email with our service.
In order to keep Okta’s user management in sync with our tables, we are attempting to use the Java Okta SDK to update the user with Okta as well (see the ‘Update a User’ section of this).
We are aware that you can also update a user via the API as detailed here but we’d prefer to use the SDK if possible.
Here is what we are attempting:
Client client = client(oktaProperties.getApiToken());
User oktaUser = client.getUser(oktaId);
oktaUser.getProfile().setEmail(email);
oktaUser.update();
The console message when this is run:
HTTP 404, Okta E0000007 (Not found: Resource not found: newemail@email.com (User)), ErrorId <errorId>
Our theory is that the SDK is attempting the update()
call on a user with the email@email.com
address, only to find none existing in the client. This issue does not happen when updating names or phone numbers, as we are successfully able to update those.