How to use the google-auth-library.prototype function in google-auth-library

To help you get started, we’ve selected a few google-auth-library 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 flackr / circ / server / server.js View on Github external
var Server = function() {
    // TODO(flackr): Load users from disk / database.
    this.users = {};
    this.sessions = {};
    // Connections that have not yet been authenticated.
    this.authenticating = [];
    this.nextId_ = 1;
    this.authenticator = null;
    if (process.env.AUTH_CLIENT_SECRET) {
      var OAuth2 = require('google-auth-library').prototype.OAuth2;
      var serverUrl = process.env.C9_HOSTNAME ?
          ('https://' + process.env.C9_HOSTNAME) :
          'https://www.lobbyjs.com/circ';
      this.authenticator = new OAuth2(process.env.AUTH_CLIENT_ID,
                                      process.env.AUTH_CLIENT_SECRET, serverUrl + '/authenticate');
    }
    this.webServer_ = null;
    this.webSocketServer_ = null;
    if (!this.authenticator)
      console.warn('Warning: Running without authentication support');
    this.serve = serveStatic(((__dirname + '/') || '') + '../');
  };