# Including custom fields in getAccessTokenSilently and using them in rules/actions

**URL:** <https://community.auth0.com/t/including-custom-fields-in-getaccesstokensilently-and-using-them-in-rules-actions/64378>\
**Category:** Get Help\
**Created:** [June 11, 2021, 10:14pm UTC](https://community.auth0.com/t/including-custom-fields-in-getaccesstokensilently-and-using-them-in-rules-actions/64378 "2021-06-11T22:14:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rubenhak](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rubenhak/32/13024_2.png) [@rubenhak](https://community.auth0.com/u/rubenhak)\
**Post date:** [June 11, 2021, 10:14pm UTC](https://community.auth0.com/t/including-custom-fields-in-getaccesstokensilently-and-using-them-in-rules-actions/64378/1 "2021-06-11T22:14:19Z")

</div>

Hi,

We are trying to include a custom field during the login process. The purpose is to be able to inject dynamic params into payload from rules or actions. Client is a react.js app and we use `@auth0/auth0-react` library. Noticed that `getAccessTokenSilently` is extensible to include custom params:

```auto
    /**
     * If you need to send custom parameters to the Authorization Server,
     * make sure to use the original parameter name.
     */
    [key: string]: any;

```

We are using it as following:

```auto
const { getAccessTokenSilently } = useAuth0();
const accessToken = await getAccessTokenSilently({
        audience: 'my-audience',
        scope: 'read:current_user',
        'foo': 'bar'
    });

```

The question is, how we get access to `foo=bar` from inside the rules or action triggers?  
Thanks  
Ruben

---

<div class="post-metadata">

**Author:** ![stephanie.chamblee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/stephanie.chamblee/32/26087_2.png) [@stephanie.chamblee](https://community.auth0.com/u/stephanie.chamblee)\
**Post date:** [June 14, 2021, 12:58pm UTC](https://community.auth0.com/t/including-custom-fields-in-getaccesstokensilently-and-using-them-in-rules-actions/64378/3 "2021-06-14T12:58:13Z")

</div>

Hi @rubenhak,

You should be able to read the extra params in the `context.request.query` object in Rules and the `event.request.query` object in Actions.

> **[Context Object Properties in Rules](https://auth0.com/docs/customize/rules/context-object)**
>
> Learn about the properties of the Rules context object, which stores information about users' IP addresses, applications, and location.

> **[Actions Triggers: post-login - Event Object](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow/event-object)**
>
> Learn about the post-login Action trigger's event object, which provides contextual information about a single user logging in via Auth0.

---

<div class="post-metadata">

**Author:** ![rubenhak](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rubenhak/32/13024_2.png) [@rubenhak](https://community.auth0.com/u/rubenhak)\
**Post date:** [June 16, 2021, 2:44am UTC](https://community.auth0.com/t/including-custom-fields-in-getaccesstokensilently-and-using-them-in-rules-actions/64378/4 "2021-06-16T02:44:35Z")

</div>

Thank you Stephanie!

---

<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:** [July 1, 2021, 2:44am UTC](https://community.auth0.com/t/including-custom-fields-in-getaccesstokensilently-and-using-them-in-rules-actions/64378/5 "2021-07-01T02:44:51Z")

</div>

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