HTTP 400 when patching /api/v2/branding/templates/universal-login

Problem statement

Receiving 400 error when attempting to patch a New Universal Login Page Template at /api/v2/branding/templates/universal-login

Symptoms

The error may be unhelpful - For example: Data does not match any schemas from 'oneOf'

Cause

This can be caused by placing the auth0:widget in the HEAD, it is required to be in the BODY of the page template.

There is also a size limit on New Universal Login Page Templates, they can not be bigger than 102,400 characters.

Solution

Make sure the auth0:widget is defined in the BODY of the HTML template and verify that the page template is smaller than 102,400 characters.

There may be other use cases where this error happens due to a JSON payload that doesn’t work well with the set template API .

The best way to recover from this state is to delete the template and set a new template using an HTML payload. As documented in the API explorer, set template API supports HTML payload using content-type set to text/html.