Access oAuth Claims for User

I have a REST API Resource that uses oAuth. This works great so far. But I need to access the claims from the issued Access token in my application. Is there a way to do this? Alternatively, I need to access custom fields on my authenticated user from my apps.

As an example, say my users belong to a parent with id (parent_123). I want to show in my app a title that says "Your Parent ID is {{current_user.parent_id)}}".

Or "Your Parent ID is {{access_token_from_oauth.claims.parent_id)}}"

These are just samples. The real use case is that my tokens have roles, and I want to show/hide elements based on the roles from the token (but custom user fields) would also work. I can do this with external user flow for the embed API, using meta data and userInfo.

Is there a way to do this?

Thanks

Hey @victory!

There have been requests before to be able set custom attributes on the current_user however support for it is somewhat limited at the moment. Outside of using the Embed API there isn't a way to set metadata.

Generally, if you want to store values for particular users that'd be done with something like localStorage from in the app itself. Auth flows run in the backend separate from the browser though so I'm not sure how you'd access those variables outside of making a request to an API that exposes them in the response (something like postman echo).

Definitely curious to know if other folks have found solutions to this problem! Otherwise, I can update this thread if more support for setting current_user values is added.

Yeah, there is an endpoint I can hit that will return the data from the current token. I can store that as you say in local storage.