# JavaScript in New Universal Login Liquid Template

**URL:** <https://community.auth0.com/t/javascript-in-new-universal-login-liquid-template/105075>\
**Category:** Get Help\
**Tags:** login-experience, new-universal-login-experience\
**Created:** [April 19, 2023, 2:01pm UTC](https://community.auth0.com/t/javascript-in-new-universal-login-liquid-template/105075 "2023-04-19T14:01:59Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![nnikkhoui](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nnikkhoui/32/46465_2.png) [@nnikkhoui](https://community.auth0.com/u/nnikkhoui)\
**Post date:** [April 19, 2023, 2:01pm UTC](https://community.auth0.com/t/javascript-in-new-universal-login-liquid-template/105075/1 "2023-04-19T14:01:59Z")

</div>

Hello! Is there any way to load custom JavaScript into the New Universal Login Liquid template? I’ve tried adding tags which throws a console error, tried parsing through the Liquid documentation but couldn’t find a solution that worked?

---

<div class="post-metadata">

**Author:** ![nnikkhoui](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nnikkhoui/32/46465_2.png) [@nnikkhoui](https://community.auth0.com/u/nnikkhoui)\
**Post date:** [April 19, 2023, 4:03pm UTC](https://community.auth0.com/t/javascript-in-new-universal-login-liquid-template/105075/2 "2023-04-19T16:03:09Z")

</div>

I have since realized that its a bug with Storybook in that the tags throw an error. If i just update the template, it renders OK. I’m not sure if this would be a bug in auth0’s configuration of storybook, or storybook itself?

---

<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:** [April 19, 2023, 4:26pm UTC](https://community.auth0.com/t/javascript-in-new-universal-login-liquid-template/105075/4 "2023-04-19T16:26:49Z")

</div>

Hi @nnikkhoui,

Welcome to the Auth0 Community!

You should be able to [add custom JS using the page templates API](https://community.auth0.com/t/new-universal-login-page-customization/82569). Can you give an example of what’s not working?

---

<div class="post-metadata">

**Author:** ![nnikkhoui](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nnikkhoui/32/46465_2.png) [@nnikkhoui](https://community.auth0.com/u/nnikkhoui)\
**Post date:** [April 19, 2023, 4:49pm UTC](https://community.auth0.com/t/javascript-in-new-universal-login-liquid-template/105075/5 "2023-04-19T16:49:19Z")

</div>

Hi @dan.woda !

Yes so when using the Auth0 CLI to update my template via:

```auto
auth0 branding templates update

```

if i add `<script></script>` right before the closing `<body>` tag (Example)

```auto
	<body class="_widget-auto-layout">
    {% if prompt.name == "login" or prompt.name == "signup" %} 
	<div class="prompt-wrapper">
	<div class="before-widget">
	{%- auth0:widget -%}
	</div>
        </div>
    {% else %}
        {%- auth0:widget -%}
    {% endif %} 
    <script type="text/javascript"></script>
  </body>

```

The UI that displays in storybook gives me the following error:  
 ![Screen Shot 2023-04-19 at 12.50.31 PM](https://global.discourse-cdn.com/auth0/original/3X/7/f/7f38838b8f09b5bb28c241878d44db0ea4bd1bda.png)

When I ignore this error, and save my template anyway, the UI that is actually deployed and displayed is works as it should! For some reason, the `<script></script>` tags do not seem to work well with Storybook.

---

<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:** [April 19, 2023, 5:44pm UTC](https://community.auth0.com/t/javascript-in-new-universal-login-liquid-template/105075/6 "2023-04-19T17:44:57Z")

</div>

@nnikkhoui,

I’m not familiar, what is storybook?

---

<div class="post-metadata">

**Author:** ![nnikkhoui](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nnikkhoui/32/46465_2.png) [@nnikkhoui](https://community.auth0.com/u/nnikkhoui)\
**Post date:** [April 19, 2023, 6:05pm UTC](https://community.auth0.com/t/javascript-in-new-universal-login-liquid-template/105075/7 "2023-04-19T18:05:32Z")

</div>

[Storybook](https://storybook.js.org/) is a tool to display UI components!  
its used by the Auth0 CLI to display what your current template will looks like ([docs here](https://auth0.com/docs/customize/universal-login-pages/universal-login-page-templates#using-the-auth0-cli-))

---

<div class="post-metadata">

**Author:** ![will.vedder](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/will.vedder/32/46585_2.png) [@will.vedder](https://community.auth0.com/u/will.vedder)\
**Post date:** [April 21, 2023, 5:41pm UTC](https://community.auth0.com/t/javascript-in-new-universal-login-liquid-template/105075/8 "2023-04-21T17:41:41Z")

</div>

Hi Nikki, here are two resources that will help you with inserting inline scripts to your templates:

- [Community post that addresses the exact issue you’re experiencing and how to fix](https://community.auth0.com/t/the-script-tag-breaks-the-auth0-cli-storybook/90526)
- [Related Github issue with addition of helpful code comment](https://github.com/auth0/auth0-cli/issues/482#issuecomment-1512901964)

Hope that helps! Also, be sure to update to version 1.0.0 the Auth0 CLI. It was recently released and packs a number of improvements and bug fixes, especially for the universal login template experience.

---

<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:** [April 21, 2023, 5:43pm UTC](https://community.auth0.com/t/javascript-in-new-universal-login-liquid-template/105075/9 "2023-04-21T17:43:29Z")

</div>

Thanks @will.vedder! Let us know if there is anything else.

---

<div class="post-metadata">

**Author:** ![nnikkhoui](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nnikkhoui/32/46465_2.png) [@nnikkhoui](https://community.auth0.com/u/nnikkhoui)\
**Post date:** [April 21, 2023, 5:50pm UTC](https://community.auth0.com/t/javascript-in-new-universal-login-liquid-template/105075/10 "2023-04-21T17:50:26Z")

</div>

@will.vedder AH i totally missed that existing Auth0 post - thank you so much! was scratching my head over this for a long time. Thank you @dan.woda as well!

---

<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:** [May 5, 2023, 5:51pm UTC](https://community.auth0.com/t/javascript-in-new-universal-login-liquid-template/105075/11 "2023-05-05T17:51:22Z")

</div>

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