# How do I make an update to my database after first user signup?

**URL:** <https://community.auth0.com/t/how-do-i-make-an-update-to-my-database-after-first-user-signup/47140>\
**Category:** Get Help\
**Created:** [July 29, 2020, 4:53pm UTC](https://community.auth0.com/t/how-do-i-make-an-update-to-my-database-after-first-user-signup/47140 "2020-07-29T16:53:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![andersco](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/andersco/32/35347_2.png) [@andersco](https://community.auth0.com/u/andersco)\
**Post date:** [July 29, 2020, 4:53pm UTC](https://community.auth0.com/t/how-do-i-make-an-update-to-my-database-after-first-user-signup/47140/1 "2020-07-29T16:53:24Z")

</div>

I am building a React app, with a Mongo DB db, and an express-based API. After a user registers, I would like to create a new User record in my database and add some default values, such that I can display an appropriate homepage for a signed in user. I have reviewed the Auth0 docs and am not able to locate a clear solution for this.

If I were handling the signup myself via my own API, this would be trivial, as I would just create the record as part of the signup call. However, now it is not at all clear how I can hook into an Auth0 registration event.

One option seems to be to use Hooks, but it’s not clear how I would interface with my API from an Auth0 hook.

Any tips or suggestions would be appreciated!

---

<div class="post-metadata">

**Author:** ![markd](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/markd/32/38919_2.png) [@markd](https://community.auth0.com/u/markd)\
**Post date:** [July 29, 2020, 10:24pm UTC](https://community.auth0.com/t/how-do-i-make-an-update-to-my-database-after-first-user-signup/47140/2 "2020-07-29T22:24:56Z")

</div>

Hello @andersco,

Welcome to the Community! I suspect you could do this with the post-registration hook or a rule (rules execute after the user logs in). In either case hooks and rules are just javascript, and you have access to a large library of modules to leverage ([Can I require? - Search which node modules you can use in webtask.io](https://auth0-extensions.github.io/canirequire/)). A hook or rule can call an API to create the database record, or you can call the database directly.

---

<div class="post-metadata">

**Author:** ![andersco](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/andersco/32/35347_2.png) [@andersco](https://community.auth0.com/u/andersco)\
**Post date:** [July 30, 2020, 12:45pm UTC](https://community.auth0.com/t/how-do-i-make-an-update-to-my-database-after-first-user-signup/47140/3 "2020-07-30T12:45:51Z")

</div>

Thanks for the suggestion.

My understanding is that hooks are defined by snippets of code that are added via the Auth0 dashboard.

In order to update a User record in my database, the hook would need to supply the proper credentials to the db server. How can I securely pass in my db credentials to a hook? (Normally, I would do that via an environment variable but not clear how that works for a hook.)

---

<div class="post-metadata">

**Author:** ![andersco](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/andersco/32/35347_2.png) [@andersco](https://community.auth0.com/u/andersco)\
**Post date:** [July 30, 2020, 1:23pm UTC](https://community.auth0.com/t/how-do-i-make-an-update-to-my-database-after-first-user-signup/47140/4 "2020-07-30T13:23:44Z")

</div>

Think I found the answer: [Hook Secrets](https://auth0.com/docs/hooks/hook-secrets)

---

<div class="post-metadata">

**Author:** ![markd](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/markd/32/38919_2.png) [@markd](https://community.auth0.com/u/markd)\
**Post date:** [August 1, 2020, 1:58pm UTC](https://community.auth0.com/t/how-do-i-make-an-update-to-my-database-after-first-user-signup/47140/5 "2020-08-01T13:58:22Z")

</div>

You got it … both hooks and rules can use configuration variables / secrets stored within Auth0. For rules:

> **[Store Rule Configurations](https://auth0.com/docs/customize/rules/configuration)**
>
> Learn about the global configuration object in rules for storing commonly used values.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [August 3, 2020, 8:26am UTC](https://community.auth0.com/t/how-do-i-make-an-update-to-my-database-after-first-user-signup/47140/6 "2020-08-03T08:26:17Z")

</div>

Thanks for sharing that link Mark!
