本文整理匯總了TypeScript中auth0.ManagementClient.getUsers方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript ManagementClient.getUsers方法的具體用法?TypeScript ManagementClient.getUsers怎麽用?TypeScript ManagementClient.getUsers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類auth0.ManagementClient
的用法示例。
在下文中一共展示了ManagementClient.getUsers方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
const management = new auth0.ManagementClient({
token: '{YOUR_API_V2_TOKEN}',
domain: '{YOUR_ACCOUNT}.auth0.com'
});
const auth = new auth0.AuthenticationClient({
domain: '{YOUR_ACCOUNT}.auth0.com',
clientId: '{OPTIONAL_CLIENT_ID}',
clientSecret: '{OPTIONAL_CLIENT_SECRET}'
});
// Using a callback.
management.getUsers((err: Error, users: auth0.User[]) => {
if (err) {
// Handle error.
}
console.log(users);
});
// Using a Promise.
management
.getUsers()
.then((users) => {
console.log(users);
})
.catch((err) => {
// Handle the error.
});
// Search users without paging - callback style
management.getUsers({search_engine: 'v3', q: 'name:"jane"', per_page: 25}, (err: Error, users: auth0.User[]) => {
示例2:
import * as auth0 from 'auth0';
const management = new auth0.ManagementClient({
token: '{YOUR_API_V2_TOKEN}',
domain: '{YOUR_ACCOUNT}.auth0.com'
});
const auth = new auth0.AuthenticationClient({
domain: '{YOUR_ACCOUNT}.auth0.com',
clientId: '{OPTIONAL_CLIENT_ID}'
});
// Using a callback.
management.getUsers((err: Error, users: auth0.User[]) => {
if (err) {
// Handle error.
}
console.log(users);
});
// Using a Promise.
management
.getUsers()
.then((users) => {
console.log(users);
})
.catch((err) => {
// Handle the error.
});
management
.createUser({