# Example of Saving the user\_Id in application database

**URL:** <https://community.auth0.com/t/example-of-saving-the-user-id-in-application-database/17325>\
**Category:** Get Help\
**Tags:** user-profile, user-creation\
**Created:** [October 28, 2018, 10:40pm UTC](https://community.auth0.com/t/example-of-saving-the-user-id-in-application-database/17325 "2018-10-28T22:40:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![himanshu.kr.arora](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@himanshu.kr.arora](https://community.auth0.com/u/himanshu.kr.arora)\
**Post date:** [October 28, 2018, 10:40pm UTC](https://community.auth0.com/t/example-of-saving-the-user-id-in-application-database/17325/1 "2018-10-28T22:40:22Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![ericarellano](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ericarellano/32/9316_2.png) [@ericarellano](https://community.auth0.com/u/ericarellano)\
**Post date:** [October 28, 2018, 11:18pm UTC](https://community.auth0.com/t/example-of-saving-the-user-id-in-application-database/17325/2 "2018-10-28T23:18:44Z")

</div>

Hi, the closest I found was guidance from [Auth0: Create user in local database after Auth0 sign up - Stack Overflow](https://stackoverflow.com/questions/51795272/auth0-create-user-in-local-database-after-auth0-sign-up).

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.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [August 27, 2019, 1:56pm UTC](https://community.auth0.com/t/example-of-saving-the-user-id-in-application-database/17325/3 "2019-08-27T13:56:49Z")

</div>

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