How to test a custom Auth0 hosted error page? And missing template variables

Hi,

I am trying to test a custom Auth0 hosted error page. We are intending to use the Auth0 CLI to upload the tenant settings, including the custom error page. Since we will have a Test tenant and Prod tenant we would like the error page template to switch between pointing to Prod and Test URLs accordingly (I ideally wouldn’t want the templates to have to include the client_ids of the different applications in Test and Prod). The following section of the docs shows the available variables:

Of those variables all seem to be available, except {connection} and {logo_url} (when a ‘unauthorized_client’ error occurs, at least).

This page talks about variables also but suggests that tenant variables are available:

" Tenant : the tenant information (the friendly name, logo URL, support email, and support URL fields that you may customize)."

I have been unable to get these variables to work, either using {tenant.friendly_name} or {friendly_name}.

Are they only available on certain errors? Is there a recommended way of testing the error pages thoroughly, i.e. scenarios for producing error pages that will include certain variables and ones that will not? I appreciate that in some cases Auth0 might not know which application or tenant the user was intending to access.

Any insights would be helpful.

Thanks,
Jon

Hi Jon. Thanks for that question. First of all let me admit that this is a feature I’ve seldom used in the past, but I checked internally and I’m afraid the tenant fields are not available. These are the only fields you might get:

  • client_id
  • connection
  • lang
  • error
  • error_description
  • tracking
  • log_url

(and I see “might” because not all of them might be available, depending on the flow or circumstance that caused the error).

This means that, unfortunately, you’ll need to hard-code the tenant information as part of the custom error HTML as of now. I’d encourage you to add a few lines at Auth0: Secure access for everyone. But not just anyone. explaining the use case and why you’d like to have the tenant fields available in the template. These feedbacks go directly to the Product team, and this way they can see what users would like to have in the product.

1 Like

@nicolas_sabena, thanks for the response and giving us a more definitive answer on that.

May I suggest that the docs be updated to reflect what you have told me there?

Thanks,
Jon

1 Like

So while I was replying you I checked the docs and there wasn’t much wrong about them, except a misspelled attribute name and the sample HTML. I submitted this pull request at that time: Fix variable name and sample for custom error page by nicosabena · Pull Request #8689 · auth0/docs · GitHub

Was there any other place where you think I need to update something?

It would be good if it was more clear that not all variable would be available in all error scenarios - that the variables “might” be available. It would be great if there was some indication of which variables would be available for certain (kinds of) errors, depending on the number of possible outcomes (I suppose that they could be grouped?). This would be particularly helpful since there is not a single way to test all of the possible variables that one might be using in their template.

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