How to get user id of a user after login in React hook useAuth0()?

Hi! I need to get user_id form Auth0 in my React app, but in the user object of useAuth0() hook I don’t have this param. How can I receive this param in React?

Hi @y.savchenko,

In the user object, you can retrieve the Auth0 user Id from it’s sub property.

const { user } = useAuth0();

console.log("user id:", user.sub);

Thanks for sharing that @supun!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.