Code snippet:
async getUsersByEmail(value) {
try {
return await Promise.all([
oktaClient.listUsers({
search: value,
}),
]).then((values) => {
console.log(values);
});
} catch (e) {
throw Error('Cannot get the users: ' + e);
}
}
Response:
[
Collection {
nextUri: "http://test-admin.okta.com/api/v1/users?search=profile.email%20eq%20'test%40gmail.com'%20",
client: Client {
requestExecutor: [DefaultRequestExecutor],
authorizationMode: 'SSWS',
baseUrl: 'http://test-admin.okta.com',
apiToken: 'dhdkjaskjassad',
http: [Http]
},
factory: ModelFactory { Ctor: [class User extends Resource] },
currentItems: [],
request: undefined
}
]
I am unable to get response array while trying to use already available okta-sdk-nodejs's listUsers method. Though, I am getting correct response with same request parameters while trying to run with Postman.
OKTA SDK node.js Link (Go to Search for Users section)
I am using the following method ->
client.listUsers({
search: 'profile.email eq "test@gmail.com"'
}).each(user => {
console.log('User matches search:', user);
});