# Adding user metadata in the pre-user registration hook

**URL:** <https://community.auth0.com/t/adding-user-metadata-in-the-pre-user-registration-hook/53665>\
**Category:** Get Help\
**Tags:** user\_metadata, login, auth0\
**Created:** [November 22, 2020, 8:44pm UTC](https://community.auth0.com/t/adding-user-metadata-in-the-pre-user-registration-hook/53665 "2020-11-22T20:44:09Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [November 23, 2020, 4:31pm UTC](https://community.auth0.com/t/adding-user-metadata-in-the-pre-user-registration-hook/53665/3 "2020-11-23T16:31:05Z")

</div>

Hi @jaredgalanis1,

Welcome to the Community!

I think you should be able to do what you are describing. Can you share your code so I can trouble shoot the issues? Here is a thread that describes how to send a param to the pre reg hook:

> [@Hook/lock custom parameter](https://community.auth0.com/t/hook-lock-custom-parameter/7582):
>
> I’m passing a custom parameter to the lock with no issues: webAuth.authorise({ foo: ‘bar’ }); I’d like to be able to access this parameter in the pre-registration hook, but can’t figure out if there is a way to do this.

and here is a thread that describes how to add it to the user\_metadata property:

[https://community.auth0.com/t/set-user-metadata-property-on-signup-hook/26516](https://community.auth0.com/t/set-user-metadata-property-on-signup-hook/26516)

> [@jaredgalanis1](#):
>
> furthermore the metadata does get set on the user when I view it in the auth0 web interface, but that metadata isn’t returned in when requesting the user’s profile.

This issue is because it isn’t automatically returned in the user profile. Here is a thread that shows how to set up a rule that returns user\_metadata in the id token:

[https://community.auth0.com/t/when-successful-login-id-token-has-not-the-user-metadata/12400/2](https://community.auth0.com/t/when-successful-login-id-token-has-not-the-user-metadata/12400/2)

> [@jaredgalanis1](#):
>
> I don’t think I can do this work in a rule because I need to make the external request with secret credentials and I don’t see any way to set a secret in a rule.

It is actually possible to do this in rules, and if you are wanting to add this property to social users you would have to do this in a rule. Hooks don’t run for non-database users.

You can add credentials in rules in the configuration object:

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

I know that is a lot of info so please let me know if you have questions!

---

_[View the full topic](https://community.auth0.com/t/adding-user-metadata-in-the-pre-user-registration-hook/53665)._
