How to update user app_metadata

Hi @andrewscofield,

Yes, that is correct. With node-auth0 you can use the ManagementClient to make these calls:

var ManagementClient = require('auth0').ManagementClient;

var management = new ManagementClient({
  token: '{YOUR_API_V2_TOKEN}',
  domain: '{YOUR_ACCOUNT}.auth0.com'
});

var params = { id: USER_ID };
var metadata = {
  foo: 'bar'
};

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

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

But this functionality is not built into the nextjs-auth0 library.

You can get more information about using the management API in client JS here: Get Management API Access Tokens for Single-Page Applications

2 Likes