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

api
rest

#1

I need to access custom attributes I’ve set during registration for my users, fetch and then modify them. Using the Get Current User API doesn’t return those information (why?). Furthermore i noticed under User Model APIs that you can actually return more fields but there no example on how to do that.


#2

I found part of the solution here:
https://developer.okta.com/docs/api/resources/apps.html?&_ga=2.239089347.1912012490.1518365493-1390383547.1516119228#get-assigned-user-for-application

But users info can be accessed only if you are authenticated as Admin, so no use for everyone. Furthermore those APIs seems not working in localhost due to CORS header missing in the API’s response


#3

How are you registering your users?

I believe what you want to do is get the custom claims into either A) the tokens or B) userInfo endpoint. You can access the appuser’s information in an expression to get appuser.customAttributeName and configure your authorization server’s claims to do exactly that.

Let me know any questions.


#4

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.