Management API (Create Users) Recognizes a Boolean value as Text

I am receiving a Payload validation error but can’t seem to identify the issue. Everything looks fine from my side. I am using Xano for reference. I can successfully execute this call as a test from the Autho0 Management API docs with a production token so there is no issue there. Why doesn’t it like this value?

Hi @rwarner,

Thanks for reaching out to the Auth0 Community!

The error indicates that the request passed a string instead of a boolean:
Actual behavior:
email_verified: "true"

Expected behavior:
email_verified: true

I was able to reproduce this error as well:

With that, I recommend double-checking that your Update a user request passes a boolean value for the email_verified property.

I hope this helps!

Please reach out if you have any further questions.

Thanks,
Rueben

Hi Rueben. I understand the error. My point is that I am passing a boolean value and it is returning this error. Thoughts?

1 Like

Hi @rwarner,

Thank you for your reply.

Could you please share with me the full request you made?

It seems that, somewhere in the code, the true value is not being treated as a boolean.

I look forward to your reply.

Thanks,
Rueben

Hi @rwarner,

Here is also an example script I ran that worked.

Could you also please try this script and let me know if it works for you?

Take note that I used Passwordless Email as my connection.

var axios = require('axios');
var data = JSON.stringify({
  "connection": "email",
  "email": "test@example.com",
  "email_verified": true
});

var config = {
  method: 'post',
  url: 'https://{{auth0_domain}}/api/v2/users',
  headers: { 
    'Authorization': 'Bearer {{auth0_token}}', 
    'Content-Type': 'application/json'
  },
  data : data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

Thanks,
Rueben

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