# When I get the user I don't get their credentials

**URL:** <https://forum.keycloak.org/t/when-i-get-the-user-i-dont-get-their-credentials/23061>\
**Category:** Miscellanaeous\
**Created:** [October 23, 2023, 10:54pm UTC](https://forum.keycloak.org/t/when-i-get-the-user-i-dont-get-their-credentials/23061 "2023-10-23T22:54:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![erosasl](https://avatars.discourse-cdn.com/v4/letter/e/e8c25b/32.png) [@erosasl](https://forum.keycloak.org/u/erosasl)\
**Post date:** [October 23, 2023, 10:54pm UTC](https://forum.keycloak.org/t/when-i-get-the-user-i-dont-get-their-credentials/23061/1 "2023-10-23T22:54:28Z")

</div>

Hello, a hand with this when I obtain the username the credentials are always null, it is possible to obtain the password through the user

```auto
public Usuario getUsuario(String username) {
		RealmResource realmResource = keycloak.realm(this.keyCloackPropierties.getRealm());
		UserRepresentation user =realmResource.users().search(username,true).get(0); 
		log.info("user {}->",jsonutil.toJson(user));//ok
		log.info("credentials {}->",user.getCredentials() );//:( is null!!!
		return this.keyCloackMap.map(user);
	}

```

log

```auto
e[2m2023-10-23T19:52:52.965-03:00e[0;39m e[32m INFOe[0;39m e[35m17524e[0;39m e[2m---e[0;39m e[2m[nio-8080-exec-1]e[0;39m e[36mc.w.keycloack.service.KeyCloackUsuarios e[0;39m e[2m:e[0;39m user {"id":"6f7a63c9-cbe7-41d1-951a-dc9334a04019","createdTimestamp":1698087165841,"username":"alice","enabled":true,"totp":false,"emailVerified":false,"firstName":"alice ","lastName":"test","email":"alice@gmail.com","disableableCredentialTypes":[],"requiredActions":[],"notBefore":0,"access":{"manageGroupMembership":true,"view":true,"mapRoles":true,"impersonate":true,"manage":true}}->
e[2m2023-10-23T19:52:52.965-03:00e[0;39m e[32m INFOe[0;39m e[35m17524e[0;39m e[2m---e[0;39m e[2m[nio-8080-exec-1]e[0;39m e[36mc.w.keycloack.service.KeyCloackUsuarios e[0;39m e[2m:e[0;39m credentials null->

```

dependency\>  
org.keycloak  
keycloak-admin-client  
22.0.4

java version 18

Can I bring the password or not?

---

<div class="post-metadata">

**Author:** ![xgp](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/xgp/32/2589_2.png) [@xgp](https://forum.keycloak.org/u/xgp)\
**Post date:** [October 31, 2023, 7:16pm UTC](https://forum.keycloak.org/t/when-i-get-the-user-i-dont-get-their-credentials/23061/2 "2023-10-31T19:16:57Z")

</div>

> [@erosasl](#):
>
> Can I bring the password or not?

No. You cannot retrieve a password for a user.
