How to add html file in auth0 universal login using terraform

I want to add html code in auth0 branding universal login. I tried with terraform branding resource as:

resource "auth0_branding" "my_brand" {
  universal_login {
    # Ensure that "{%- auth0:head -%}" and "{%- auth0:widget -%}"
    # are present in the body.
    body = file("test.html")

But got error as:

 Error: 400 Bad Request: The template must contain a single auth0:head tag and at least one auth0:widget tag.

I also want to enable custom login page but I don’t see any terraform argument to enable it in auth0_branding resource.

How can do it ?

Hi @mayank_jadhav,

Thanks for reaching out to the Auth0 Community!

The code snippet you shared is the correct way to add an HTML file to the Auth0 Branding resource to set the HTML for the New Universal Login page.

The error you received indicates that your test.html file did not include a single auth0:head tag and at least one auth0:widget tag.

Following our Customize New Universal Login Pages documentation, the simplest template that can be written should look like this:

<!DOCTYPE html><html>
    {%- auth0:head -%}
    {%- auth0:widget -%}

Considering this, could you please confirm if your test.html file has a similar structure?

Another quick way to test this is by using the template above to see if the issue goes away. If so, you can gradually add your custom HTML code to identify any conflicts.

Please let me know how this goes for you.


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