Authenticated as users, how do you get and modify custom attributes for users in your app?

Through your beta registration service inside your hosted widget.
From your other answer here I learned that I have to pass through my backend to fetch users information but I’m struggling to understand how to get the users ID from the java.security.Principal.
By now, the only way i found to get user app infos is to retrive the id with the Java SDK using principal.name, then use the id to query the APIs, but it’s kinda long, there must be an easier way.