Enrich user object with user profile attributes in auth0 Actions

I’m trying to append my user object with the attributes that already existed in Auth0 user profile, for example:

  • blocked_for
  • last_ip
  • last_login

I’ve read several topics about this but none of them satisfy my needs. I already known about the custom namespaced claim when append to idToken.

So my question is how exactly can I get those attributes on auth0 Actions (or Rules)?
I also saw a solution that we use Management API to get user in Rules, the user object from that response has all the properties in profile. Is it the only way to get that?

Hi @quocvan1311,

Welcome to the Auth0 Community!

That is correct. The Management API is the only way to retrieve the complete user profile when using Actions or Rules.

In this case, I recommend using a Post-Login Action to add/update the last_ip, last_login, and blocked properties in the user’s user_metadata.

Please see this FAQ on using the Management API in Actions.

Hoped this helps!

Please let me know if you have any further questions.

Thank you.

1 Like