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?
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?
Hi @nnikkhoui,
Welcome to the Auth0 Community!
You should be able to add custom JS using the page templates API. Can you give an example of what’s not working?
Hi @dan.woda !
Yes so when using the Auth0 CLI to update my template via:
auth0 branding templates update
if i add <script></script>
right before the closing <body>
tag (Example)
<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:
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.
I’m not familiar, what is storybook?
Storybook is a tool to display UI components!
its used by the Auth0 CLI to display what your current template will looks like (docs here)
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
- Related Github issue with addition of helpful code comment
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.
Thanks @will.vedder! Let us know if there is anything else.
@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!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.