I have error when use patchUserMetadata API

Hi @tim.dang1,

Thank you for your response.

You should use the token that you get from programmatically calling the Management API in a client credentials flow.

For example:

var ManagementClient = require('auth0').ManagementClient;
var management = new ManagementClient({
  domain: '{YOUR_ACCOUNT}.auth0.com',
  clientId: '{YOUR_NON_INTERACTIVE_CLIENT_ID}',
  clientSecret: '{YOUR_NON_INTERACTIVE_CLIENT_SECRET}'
});

Then we can update the user by calling the updateUserMetadata method:

var params = { id: USER_ID };
var metadata = {
  address: '123th Node.js Street'
};

management.updateUserMetadata(params, metadata, function (err, user) {
  if (err) {
    // Handle error.
  }

  // Updated user.
  console.log(user);
});

References:

Please let me know if you have any questions.

Thanks,
Rueben