# Java SDK- login attribute value is resetting to email value when user trying to update email

**URL:** <https://devforum.okta.com/t/java-sdk-login-attribute-value-is-resetting-to-email-value-when-user-trying-to-update-email/15006>\
**Category:** Questions\
**Created:** [July 3, 2021, 3:24pm UTC](https://devforum.okta.com/t/java-sdk-login-attribute-value-is-resetting-to-email-value-when-user-trying-to-update-email/15006 "2021-07-03T15:24:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sgaddala](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@sgaddala](https://devforum.okta.com/u/sgaddala)\
**Post date:** [July 3, 2021, 3:24pm UTC](https://devforum.okta.com/t/java-sdk-login-attribute-value-is-resetting-to-email-value-when-user-trying-to-update-email/15006/1 "2021-07-03T15:24:27Z")

</div>

When try the below, its updating login attribute value with email. I have tried using both java object and rest endpoint. In both cases its updating login value along with email.  
Is it real bug in Okta?

with below code its updating both login and email attributes with “[test123@test.example.com](mailto:test123@test.example.com)”, which is not expected.

## client = Clients.builder() .setOrgUrl(“${yourOktaDomain}”) .setClientId(“{}”) .setClientCredentials(cc) .build(); User user = client.getUser(userId); UserProfile up = user.getProfile(); up.setEmail(“[test123@test.example.com](mailto:test123@test.example.com)”); user.setProfile(up); user.update(); ================================ Curl Command:

curl -v -X POST   
-H “Accept: application/json”   
-H “Content-Type: application/json”   
-H “Authorization: SSWS ${api\_token}”   
-d ‘{  
“profile”: {  
“firstName”: “santhi”,  
“email”: “[test123@test.example.com](mailto:test123@test.example.com)”,  
“mobilePhone”: “555-415-1337”  
}  
}’ “https://${yourOktaDomain}/api/v1/users/{okta-id}”

 ![Screenshot 2021-07-03 at 8.51.18 PM](https://global.discourse-cdn.com/oktadev/original/2X/9/964938b5384ca3556872ce09d8081832b9cf7232.jpeg)  
 ![Screenshot 2021-07-03 at 8.51.36 PM](https://global.discourse-cdn.com/oktadev/original/2X/d/d7f455385b7bf11b7051a58d779d48caeb847c4b.jpeg)

Please let me know if anyone seen it and if have any workaround.

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [July 6, 2021, 5:44pm UTC](https://devforum.okta.com/t/java-sdk-login-attribute-value-is-resetting-to-email-value-when-user-trying-to-update-email/15006/2 "2021-07-06T17:44:44Z")

</div>

Do you have Self-Service Registration enabled in your tenant? If so, the login and email values for all users in your Okta org will be set to the same value during creation/update.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [February 8, 2024, 6:40pm UTC](https://devforum.okta.com/t/java-sdk-login-attribute-value-is-resetting-to-email-value-when-user-trying-to-update-email/15006/3 "2024-02-08T18:40:13Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
