How to use the swagger-client.authorizations function in swagger-client

To help you get started, we’ve selected a few swagger-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github asterisk / node-ari-client / Gruntfile.js View on Github external
var resourcesLib = require('./lib/resources.js');

    var operations = '';
    var events = '';

    var operationTemplate = fs.readFileSync(
      './dev/operation.mustache',
      'utf-8'
    );
    var eventTemplate = fs.readFileSync(
      './dev/event.mustache',
      'utf-8'
    );

    var parsedUrl = url.parse(options.baseUrl);
    swagger.authorizations.add(
      'basic-auth',
      new swagger.PasswordAuthorization(
        parsedUrl.hostname,
        options.username,
        options.password
      )
    );

    // Connect to API using swagger and attach resources on Client instance
    var resourcesUrl = util.format(
      '%s//%s/ari/api-docs/resources.json',
      parsedUrl.protocol,
      parsedUrl.host
    );
    var swaggerClient = new swagger.SwaggerApi({
      url: resourcesUrl,
github asterisk / node-ari-client / lib / client.js View on Github external
return new Promise(function(resolve, reject) {

    swagger.authorizations.add(
      'basic-auth',
      new swagger.PasswordAuthorization(
        self._connection.hostname,
        self._connection.user,
        self._connection.pass
      )
    );

    // Connect to API using swagger and attach resources on Client instance
    var ariUrl = util.format(
      '%s//%s/ari/api-docs/resources.json',
      self._connection.protocol,
      self._connection.host
    );

    request(ariUrl, function (err) {