Auth0 Home Blog Docs

Example of Saving the user_Id in application database



I have added Auth0 to my application and am following the docs for the single page applications (Angular2). After user logs in, I fetch the profile by invoking auth0.client.userInfo with scope: ‘openid profile’. There is no user_id in that profile object. I want to store the user_id in my application and associate it with other data. I want this user id to serve as a key for fetching data from other tables in my app. Is there an example demonstrating something similar?


Hi, the closest I found was guidance from

I chose to go with the first approach of creating a Pre User Registration Hook that will send a POST request to my database, then store my own user ID in Auth0’s user_metadata. Then, whenever I get the profile from Auth0 after a user logs in, I already have my own app’s ID.