Use the Management API from within Rules
In this article
From within any Rule you write, you can update a user's app_metadata
or user_metadata
using the auth0, which is a specially-restricted instance of ManagementClient
(defined in the node-auth0 Node.js client library) and provides limited access to the Auth0 Management API.
To access additional Management API endpoints from inside Rules, you have to use another version of the library.
Access a newer version of the library
You can load a newer version of the Auth0 Node.js client library by requiring the specific version of the library. For up-to-date version information, check the repository.
In this example, we load version 2.9.1
of the library, then query the list of users and logs the users to the console (to be inspected with the Real-time Webtask Logs Extension).
function (user, context, callback) {
var ManagementClient = require('auth0@2.9.1').ManagementClient;
var management = new ManagementClient({
token: auth0.accessToken,
domain: auth0.domain
});
management.getUsers(function (err, users) {
console.log(users);
callback(null, user, context);
});
}
Was this helpful?/