loadUserProfile metadata issues

There are 2 methods in keycloak-js (client) that can be used to get user metadata.

  • loadUserProfile
  • loadUserInfo

Going through the code for this js client they do requests differently and also their responses are different.

loadUserProfile gives:

{"username":"userAdmin","firstName":"User1","lastName":"Admin","email":"user1@email.com","emailVerified":true,"attributes":{}}

loadUserInfo gives:

{"sub":"caecfbbd-f27c-4213-8bd1-94f66381e905","upn":"userAdmin","email_verified":true,"address":{},"name":"user admin","groups":["offline_access","uma_authorization"],"preferred_username":"userAdmin","given_name":"User","family_name":"Admin","email":"user1@email.com"}

If I add attributes to the user loadUserProfile fills out the attributes property, but I’m trying to understand why it doesn’t give the sub??

the keycloak.d.ts for it, it states it is optional.

anyone any thoughts on the why of this happening?