# Sending a user id to our database after signing up

**URL:** <https://community.auth0.com/t/sending-a-user-id-to-our-database-after-signing-up/83514>\
**Category:** Get Help\
**Created:** [May 16, 2022, 4:44pm UTC](https://community.auth0.com/t/sending-a-user-id-to-our-database-after-signing-up/83514 "2022-05-16T16:44:03Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![ryanhyslop](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ryanhyslop/32/37346_2.png) [@ryanhyslop](https://community.auth0.com/u/ryanhyslop)\
**Post date:** [May 17, 2022, 9:52am UTC](https://community.auth0.com/t/sending-a-user-id-to-our-database-after-signing-up/83514/3 "2022-05-17T09:52:42Z")

</div>

fwiw I found an example of what I was looking for in another thread:

> [@Custom Actions - What happens with errors?](https://community.auth0.com/t/custom-actions-what-happens-with-errors/64391):
>
> I created a custom action so when a new user registers I create a user doc in my apps database. During my test of the action it worked and the test data was saved to my database… but what happens if there is an error in my action? I don’t know how to handle the error? The ultimate goal of my action to to create the user doc and attach the userId in my database onto the Auth0 user metadata so when I make calls to my api… it’s super easy to query my database. I am guessing if creating the user…

```auto
exports.onExecutePostLogin = async (event, api) => {
  if (event.stats.logins_count !== 1) {
    // do nothing for subsequent logins, only care about the first one.
    return;
  }

  try {
    // post to our backend here with the user id from the meta data.
  } catch (e) {
    // very rare but incase our backend is unavailable
    console.log(e);
    api.access.deny('Could not log you in at this time');
  }
};

```

Which redirects to your callback url with the error query params:

`https://manage.auth0.com/tester/callback?connection=google-oauth2&error=access_denied&error_description=Could%20not%20clog%20you%20in`

I haven’t implemented this yet but this is the direction I’m going to go in

---

_[View the full topic](https://community.auth0.com/t/sending-a-user-id-to-our-database-after-signing-up/83514)._
