Updating universal login page template is not working

Problem statement

We could not update the universal login page template.

Symptoms

PUT to /api/v2/branding/templates/universal-login returns a 200 response with the old template:

{
"body": "<!DOCTYPE html>...HTML from the exisiting template...</html></code>"
}

Steps to reproduce

Either exclude https:// from the request:

curl --location --request PUT 'my-canonical-domain.us.com/api/v2/branding/templates/universal-login' \ --header 'content-type: text/html' \ --header 'Authorization: Bearer TOKEN' \ --data-raw '<!DOCTYPE html> ... my HTML ... </html>'

Or use the custom domain in the request:

curl --location --request PUT 'https://my-custom-domain.com/api/v2/branding/templates/universal-login' \ --header 'content-type: text/html' \ --header 'Authorization: Bearer TOKEN' \ --data-raw '<!DOCTYPE html> ... my HTML ... </html>'

Both return a 200 response with the following:

{ "body": "<!DOCTYPE html>...HTML from the existing template...</html></code>" }

Solution

You need to use https:// with the canonical domain to make the update:

curl --location --request PUT 'https://my-canonical-domain.us.com/api/v2/branding/templates/universal-login' \ --header 'content-type: text/html' \ --header 'Authorization: Bearer TOKEN' \ --data-raw '<!DOCTYPE html> ... my HTML ... </html>'

A request like the above will return a 204, indicating a successful update.