Creates a new duo api client. Takes a config
object as its sole argument. The config object must contain 3 elements:
Note: These values can be found by logging into your admin panel at admin.duosecurity.com
host
: Duo API host:api-XXXXXXXX.duosecurity.com
ikey
: Duo API Integration key:XXXXXXXXXXXXXXXXXXXX
skey
: Duo API Secret key:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Example:
var client = new Client({
host: 'api-XXXXXXXX.duosecurity.com',
ikey: 'XXXXXXXXXXXXXXXXXXXX',
skey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
});
Execute an http request to a duo api.
method
(required): HTTP method to use.path
(required): The API path.params
(optional): Parameters to send with request.cb
(optional): If supplied, callback that will be called on completion of request.
See Response Format for information on the structure of the response.
Examples:
Request basic duo account information via the admin api:
// Using promise interface.
client.request('get', '/admin/v1/info/summary').then(function(res) {}).catch(function(error) {});
// Using callback.
client.request('get', '/admin/v1/info/summary', null, function(error, res) {});
Request information about a user:
// Using promise interface.
client.request('get', '/admin/v1/users', {username: 'littlebobbytables'}).then(function(res) {}).catch(function(error) {});
// Using callback.
client.request('get', '/admin/v1/users', {username: 'littlebobbytables'}, function(error, res) {});