Constructor
new UsersManager(options)
Parameters:
Name |
Type |
Description |
options |
Object
|
Manager options.
Properties
Name |
Type |
Attributes |
Description |
baseUrl |
String
|
|
The auth0 account URL. |
headers |
String
|
<optional>
|
Default request headers. |
clientId |
String
|
<optional>
|
Default client ID. |
|
- Source:
Methods
getInfo(accessToken, cbopt) → {Promise|undefined}
Given an access token get the user profile linked to it.
Parameters:
Name |
Type |
Attributes |
Description |
accessToken |
String
|
|
User access token. |
cb |
function
|
<optional>
|
Callback function. |
- Source:
Returns:
-
Type
-
Promise
|
undefined
Example
Get the user information based on the Auth0 access token (obtained during
login). Find more information in the
API Docs.
auth0.users.getInfo(accessToken, function (err, userInfo) {
if (err) {
// Handle error.
}
console.log(userInfo);
});
impersonate(userId, settings, cbopt) → {Promise|undefined}
Impersonate the user with the given user ID.
Parameters:
Name |
Type |
Attributes |
Description |
userId |
String
|
|
User ID token. |
settings |
Object
|
|
Impersonation settings.
Properties
Name |
Type |
Description |
impersonator_id |
String
|
Impersonator user ID. |
protocol |
String
|
The authentication protocol. |
|
cb |
function
|
<optional>
|
Callback function. |
- Source:
Returns:
-
Type
-
Promise
|
undefined
Example
Gets a link that can be used once to log in as a specific user. Useful for
troubleshooting. Find more information in the
[API Docs](https://auth0.com/docs/auth-api#!#post--users--user_id--impersonate).
var settings = {
impersonator_id: '{IMPERSONATOR_ID}',
protocol: 'oauth2',
additionalParameters: {} // Optional aditional params.
};
auth0.users.impersonate(userId, settings, function (err, link) {
if (err) {
// Handle error.
}
console.log(link);
});