# Auth0 React: Pass custom data to liquid forms

**URL:** <https://community.auth0.com/t/auth0-react-pass-custom-data-to-liquid-forms/128000>\
**Category:** Get Help\
**Tags:** new-universal-login-experience, login-experience\
**Created:** [February 21, 2024, 8:19pm UTC](https://community.auth0.com/t/auth0-react-pass-custom-data-to-liquid-forms/128000 "2024-02-21T20:19:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![david48](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/david48/32/55040_2.png) [@david48](https://community.auth0.com/u/david48)\
**Post date:** [February 21, 2024, 8:19pm UTC](https://community.auth0.com/t/auth0-react-pass-custom-data-to-liquid-forms/128000/1 "2024-02-21T20:19:54Z")

</div>

Hi there. I’m working with a react front end application using the Universal Login. I have a use case that requires me to show some messaging on the login/signup form depending on the guarded route that was chosen. So far all attempts at getting the data into the liquid template have failed. Should I avoid liquid templates all together? Do i need to revert to embedded login to get the interaction i require?

I configured my route:

```auto
<Route
            path="/dashboard"
            element={
              <AuthenticationBoundary component={Dashboard} args={{
                loginOptions: {
                  appState: {
                    'testing123': 'foo',
                    'ext-something': 'hello'
                  }
                }
              }}/>
            }
          />

```

My authentication boundary

```auto
type RequireAuthProps = RootProps & {
  component: React.ComponentType<object>;
  args?: WithAuthenticationRequiredOptions;
};

function AuthenticationBoundary({
  component,
  args,
}: RequireAuthProps): JSX.Element {
  const Component = withAuthenticationRequired(component, args);
  return <Component />;
}
export default AuthenticationBoundary;

```

And the auth0 provider code:

```auto
return (
    <Auth0Provider
      domain={Tenant}
      clientId={ClientID}
      authorizationParams={{
        redirect_uri: `${window.location.origin}${nextPage}`,
        responseType: 'response_type',
        forgotPasswordLink: 'uri',
        'ext-randomText': 'Hello there',
      }}
      cacheLocation="localstorage"
      onRedirectCallback={onRedirectCallback}
    >
      {children}
    </Auth0Provider>
  );

```

The liquid template syntax (just to confirm the output… or lack there of):

```auto
<h1>{{ ext-sample | default: "Sample param not available"}}</h1>
<h1>{{ sample | default: "Sample param not available"}}</h1>

```

---

<div class="post-metadata">

**Author:** ![keov5991](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/keov5991/32/51319_2.png) [@keov5991](https://community.auth0.com/u/keov5991)\
**Post date:** [February 21, 2024, 9:24pm UTC](https://community.auth0.com/t/auth0-react-pass-custom-data-to-liquid-forms/128000/2 "2024-02-21T21:24:06Z")

</div>

![1708540558005_1708540550513](https://global.discourse-cdn.com/auth0/original/3X/9/9/99665113ca03c140d93c78eab66a3c02bf2b70a3.jpeg)

---

<div class="post-metadata">

**Author:** ![keov5991](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/keov5991/32/51319_2.png) [@keov5991](https://community.auth0.com/u/keov5991)\
**Post date:** [February 21, 2024, 9:26pm UTC](https://community.auth0.com/t/auth0-react-pass-custom-data-to-liquid-forms/128000/3 "2024-02-21T21:26:52Z")

</div>

> [@david48](#):
>
> `window`

```auto

**![1708323970354|366x499](upload://sq4GqncsfrkbaxBINp9ntLUHtEi.png)

**

```

128000

---

<div class="post-metadata">

**Author:** ![david48](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/david48/32/55040_2.png) [@david48](https://community.auth0.com/u/david48)\
**Post date:** [February 22, 2024, 2:52pm UTC](https://community.auth0.com/t/auth0-react-pass-custom-data-to-liquid-forms/128000/4 "2024-02-22T14:52:07Z")

</div>

Here’s the guide i used to create the liquid template: [Building Beautiful Login Pages with Auth0](https://auth0.com/blog/building-beautiful-login-pages-with-auth0/)

---

<div class="post-metadata">

**Author:** ![david48](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/david48/32/55040_2.png) [@david48](https://community.auth0.com/u/david48)\
**Post date:** [February 25, 2024, 12:42am UTC](https://community.auth0.com/t/auth0-react-pass-custom-data-to-liquid-forms/128000/5 "2024-02-25T00:42:59Z")

</div>

Please ignore the obvious error in the code snippets. I did replace the variables in the liquid template to match the code examples above and got the “Sample param not available” text

---

<div class="post-metadata">

**Author:** ![bajcmartinez](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bajcmartinez/32/46418_2.png) [@bajcmartinez](https://community.auth0.com/u/bajcmartinez)\
**Post date:** [February 26, 2024, 10:38am UTC](https://community.auth0.com/t/auth0-react-pass-custom-data-to-liquid-forms/128000/6 "2024-02-26T10:38:17Z")

</div>

hi @david48, welcome to the Auth0 community!

There are a few things to keep into consideration with what you are trying to build, first let me point out, since you read the article on “Building Beautiful Pages” that the command mentioned on the article is outdated, and though still valid, there’s a new recommended command:

```auto
auth0 universal-login customize

```

This provides a new interface, which makes it much easier to fully customize your login experience. You probably already found this out, as the CLI will advice this new command when using the previous one.

On regards to your code, I wouldn’t recommend to alter `appState` when calling `withAuthenticationRequired`, instead pass your parameters using `authorizationParams` as follows:

```javascript
export default withAuthenticationRequired(YourComponent, {
  loginOptions: {
    authorizationParams: {
      'ext-testing123': 'foo',
      'ext-something': 'hello'
    }
  }
});

```

Please name your param names with the prefix `ext-`. Then you can add the following on your liquid template:

```auto
<b>testing123:</b>{{ transaction.params.ext-testing123 }}
<b>something:</b>{{ transaction.params.ext-something }}

```

Hope this helps,  
Thanks!

Juan

---

<div class="post-metadata">

**Author:** ![david48](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/david48/32/55040_2.png) [@david48](https://community.auth0.com/u/david48)\
**Post date:** [February 26, 2024, 1:30pm UTC](https://community.auth0.com/t/auth0-react-pass-custom-data-to-liquid-forms/128000/7 "2024-02-26T13:30:47Z")

</div>

Thank you so much, Juan. I tested it out and it worked as expected. Thank you for pointing out the use of the `authorizationParams` over `appState`.

I went further to test to see if adding the `authorizationParams` in the `Route` component would overwrite the ones added on the `Auth0Provider` component. It does not, I was able to access params from both as long as they were prefixed with the `ext-` so that’s a huge plus. Thanks again!

---

<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:** [March 11, 2024, 1:31pm UTC](https://community.auth0.com/t/auth0-react-pass-custom-data-to-liquid-forms/128000/8 "2024-03-11T13:31:24Z")

</div>

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