Constructor
new UsersManager(options)
- Source:
Parameters:
Name | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
The client options.
|
Members
(inner) enrollmentsAuth0RestClient :external:RestClient
Provides an abstraction layer for retrieving Guardian enrollments.
- Source:
Type:
(inner) identitiesAuth0RestClient :external:RestClient
Provides a simple abstraction layer for linking user accounts.
- Source:
Type:
(inner) multifactorAuth0RestClient :external:RestClient
Provides an abstraction layer for consuming the Multifactor Provider endpoint.
- Source:
Type:
(inner) userLogsAuth0RestClient :external:RestClient
Provides a simple abstraction layer for user logs
- Source:
Type:
(inner) usersByEmailClient :external:RestClient
Provides an abstraction layer for the new "users-by-email" API
- Source:
Type:
Methods
create(data, cbopt) → {Promise|undefined}
Create a new user.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
data |
Object
|
User data. |
|
cb |
function
|
<optional> |
Callback function. |
Returns:
- Type:
-
Promise
|undefined
Example
management.users.create(data, function (err) {
if (err) {
// Handle error.
}
// User created.
});
delete(params, cbopt) → {Promise|undefined}
Delete a user by its id.
- Source:
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
params |
Object
|
The user data object..
|
|||||||
cb |
function
|
<optional> |
Callback function |
Returns:
- Type:
-
Promise
|undefined
Example
management.users.delete({ id: USER_ID }, function (err) {
if (err) {
// Handle error.
}
// User deleted.
});
deleteAll(cbopt) → {Promise|undefined}
Delete all users.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
cb |
function
|
<optional> |
Callback function |
Returns:
- Type:
-
Promise
|undefined
Example
management.users.deleteAll(function (err) {
if (err) {
// Handle error.
}
// Users deleted
});
deleteMultifactorProvider(params, cbopt) → {Promise|undefined}
Delete a multifactor provider.
- Source:
Parameters:
Name | Type | Attributes | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
Object
|
Data object.
|
||||||||||
cb |
function
|
<optional> |
Callback function |
Returns:
- Type:
-
Promise
|undefined
Example
var params = { id: USER_ID, provider: MULTIFACTOR_PROVIDER };
management.users.deleteMultifactorProvider(params, function (err, user) {
if (err) {
// Handle error.
}
// Users accounts unlinked.
});
get(data, cbopt) → {Promise|undefined}
Get a user by its id.
- Source:
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
data |
Object
|
The user data object.
|
|||||||
cb |
function
|
<optional> |
Callback function. |
Returns:
- Type:
-
Promise
|undefined
Example
management.users.get({ id: USER_ID }, function (err, user) {
console.log(user);
});
getAll(paramsopt, cbopt) → {Promise|undefined}
Get all users.
- Source:
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
Object
|
<optional> |
Users params.
|
||||||||||||
cb |
function
|
<optional> |
Callback function. |
Returns:
- Type:
-
Promise
|undefined
Example
// Pagination settings.
var params = {
per_page: 10,
page: 2
};
management.users.getAll(function (err, users) {
console.log(users.length);
});
getByEmail(emailopt, cbopt) → {Promise|undefined}
Get Users by an Email Address
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
email |
String
|
<optional> |
Email address of user(s) to find |
cb |
function
|
<optional> |
Callback function. |
Returns:
- Type:
-
Promise
|undefined
Example
management.users.getByEmail('email@address', function (err, users) {
console.log(users);
});
getGuardianEnrollments(data, cbopt) → {Promise|undefined}
Get a list of Guardian enrollments.
- Source:
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
data |
Object
|
The user data object.
|
|||||||
cb |
function
|
<optional> |
Callback function. |
Returns:
- Type:
-
Promise
|undefined
Example
management.users.getGuardianEnrollments({ id: USER_ID }, function (err, enrollments) {
console.log(enrollments);
});
link(userId, params, cbopt) → {Promise|undefined}
Link the user with another account.
- Source:
Parameters:
Name | Type | Attributes | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
userId |
String
|
ID of the primary user. |
||||||||||
params |
Object
|
Secondary user data.
|
||||||||||
cb |
function
|
<optional> |
Callback function. |
Returns:
- Type:
-
Promise
|undefined
Example
var params = { id: USER_ID };
var data = {
user_id: 'OTHER_USER_ID',
connection_id: 'CONNECTION_ID'
};
management.users.link(params, data, function (err, user) {
if (err) {
// Handle error.
}
// Users linked.
});
logs(params, cbopt) → {Promise|undefined}
Get user's log events.
- Source:
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
Object
|
Get logs data.
|
|||||||||||||||||||
cb |
function
|
<optional> |
Callback function. |
Returns:
- Type:
-
Promise
|undefined
Example
var params = { id: USER_ID, page: 0, per_page: 50, sort: 'date:-1', include_totals: true };
management.users.logs(params, function (err, logs) {
if (err) {
// Handle error.
}
console.log(logs);
});
unlink(params, cbopt) → {Promise|undefined}
Unlink the given accounts.
- Source:
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
Object
|
Linked users data.
|
|||||||||||||
cb |
function
|
<optional> |
Callback function. |
Returns:
- Type:
-
Promise
|undefined
Example
var params = { id: USER_ID, provider: 'auht0', user_id: OTHER_USER_ID };
management.users.unlink(params, function (err, user) {
if (err) {
// Handle error.
}
// Users accounts unlinked.
});
update(params, data, cbopt) → {Promise|undefined}
Update a user by its id.
- Source:
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
params |
Object
|
The user parameters.
|
|||||||
data |
Object
|
New user data. |
|||||||
cb |
function
|
<optional> |
Callback function |
Returns:
- Type:
-
Promise
|undefined
Example
var params = { id: USER_ID };
management.users.update(params, data, function (err, user) {
if (err) {
// Handle error.
}
// Updated user.
console.log(user);
});
updateAppMetadata(params, metadata, cbopt) → {Promise|undefined}
Update the app metadata.
- Source:
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
params |
Object
|
The user data object..
|
|||||||
metadata |
Object
|
New app metadata. |
|||||||
cb |
function
|
<optional> |
Callback function |
Returns:
- Type:
-
Promise
|undefined
Example
var params = { id: USER_ID };
var metadata = {
foo: 'bar'
};
management.users.updateAppMetadata(params, metadata, function (err, user) {
if (err) {
// Handle error.
}
// Updated user.
console.log(user);
});
updateUserMetadata(params, metadata, cbopt) → {Promise|undefined}
Update the user metadata.
- Source:
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
params |
Object
|
The user data object..
|
|||||||
metadata |
Object
|
New user metadata. |
|||||||
cb |
function
|
<optional> |
Callback function |
Returns:
- Type:
-
Promise
|undefined
Example
var params = { id: USER_ID };
var metadata = {
address: '123th Node.js Street'
};
management.users.updateUserMetadata(params, metadata, function (err, user) {
if (err) {
// Handle error.
}
// Updated user.
console.log(user);
});