# Updating the New Universal login template using the management client throws 'The data must be an object'

**URL:** <https://community.auth0.com/t/updating-the-new-universal-login-template-using-the-management-client-throws-the-data-must-be-an-object/63120>\
**Category:** Get Help\
**Created:** [May 20, 2021, 3:29pm UTC](https://community.auth0.com/t/updating-the-new-universal-login-template-using-the-management-client-throws-the-data-must-be-an-object/63120 "2021-05-20T15:29:08Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jelle](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jelle/32/12681_2.png) [@Jelle](https://community.auth0.com/u/Jelle)\
**Post date:** [May 20, 2021, 3:29pm UTC](https://community.auth0.com/t/updating-the-new-universal-login-template-using-the-management-client-throws-the-data-must-be-an-object/63120/1 "2021-05-20T15:29:09Z")

</div>

Hi there,

trying to update the New Universal Login template using the management client like explained in the docs  
[https://auth0.github.io/node-auth0/module-management.ManagementClient.html#setBrandingUniversalLoginTemplate](https://auth0.github.io/node-auth0/module-management.ManagementClient.html#setBrandingUniversalLoginTemplate)

Code snippet of my implementation\*

```
exports.setBrandingNULTemplate = async() => {
  const management = new ManagementClient({
    token,
    domain
  });

  try {
    const result = await management.setBrandingUniversalLoginTemplate({ template: 'Hiyaa' });
    console.log('result', result);

  } catch(err) {
    console.log(err);
  }
}

```

\*simplified for reasons.

This throws an error:  
`ArgumentError: The data must be an object`

When requesting the current template it returns an object with `{body: 'template'}`, so I tried using `body` instead of `template` but computer says no. Also tried `data`.

What am I doing wrong?

☮

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [May 20, 2021, 6:15pm UTC](https://community.auth0.com/t/updating-the-new-universal-login-template-using-the-management-client-throws-the-data-must-be-an-object/63120/2 "2021-05-20T18:15:34Z")

</div>

Hey there!

Judging by this one you’re doing everything correct:

 ![Screenshot 2021-05-20 at 20.14.30](https://global.discourse-cdn.com/auth0/original/3X/0/e/0e21d6702765caf5a6d7e8194ce48b94e3ae427d.png)

Guessing where else the issue might be coming from

---

<div class="post-metadata">

**Author:** ![Jelle](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jelle/32/12681_2.png) [@Jelle](https://community.auth0.com/u/Jelle)\
**Post date:** [May 21, 2021, 7:01am UTC](https://community.auth0.com/t/updating-the-new-universal-login-template-using-the-management-client-throws-the-data-must-be-an-object/63120/3 "2021-05-21T07:01:57Z")

</div>

Could/did you verify that the endpoint works for you?

Sidenote: It does work when calling the endpoint as a plain request:

```auto
const options = {
    method: 'PUT',
    url: `https://${tenantUrl}/api/v2/branding/templates/universal-login`,
    headers: {authorization: `Bearer ${token}`, 'content-type': 'text/html'},
    data: 'Template data'
  };
```

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [May 21, 2021, 8:13am UTC](https://community.auth0.com/t/updating-the-new-universal-login-template-using-the-management-client-throws-the-data-must-be-an-object/63120/4 "2021-05-21T08:13:29Z")

</div>

So I guess we’ve tracked the core reason of the issue which is the problem with the implementation in Node SDK. Can I ask you to raise it as a GitHub issue in the SDK repo and then share the link to it here so I can ping repo maintainers? Thank you!

---

<div class="post-metadata">

**Author:** ![Jelle](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jelle/32/12681_2.png) [@Jelle](https://community.auth0.com/u/Jelle)\
**Post date:** [May 21, 2021, 8:32am UTC](https://community.auth0.com/t/updating-the-new-universal-login-template-using-the-management-client-throws-the-data-must-be-an-object/63120/5 "2021-05-21T08:32:15Z")

</div>

Hi Konrad,

I’ve created the issue as requested.  
[management.setBrandingUniversalLoginTemplate returns ArgumentError: The data must be an object · Issue #623 · auth0/node-auth0 · GitHub](https://github.com/auth0/node-auth0/issues/623)

---

<div class="post-metadata">

**Author:** ![Jelle](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jelle/32/12681_2.png) [@Jelle](https://community.auth0.com/u/Jelle)\
**Post date:** [May 21, 2021, 9:21am UTC](https://community.auth0.com/t/updating-the-new-universal-login-template-using-the-management-client-throws-the-data-must-be-an-object/63120/6 "2021-05-21T09:21:53Z")

</div>

Found the issue. The example is incorrect. You MUST pass an empty object as params.

Asked the code team to update the examples.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [May 21, 2021, 10:43am UTC](https://community.auth0.com/t/updating-the-new-universal-login-template-using-the-management-client-throws-the-data-must-be-an-object/63120/7 "2021-05-21T10:43:51Z")

</div>

Perfect! Thanks a lot for sharing it with the rest of the community!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [May 27, 2021, 11:11am UTC](https://community.auth0.com/t/updating-the-new-universal-login-template-using-the-management-client-throws-the-data-must-be-an-object/63120/8 "2021-05-27T11:11:18Z")

</div>


