diff --git a/lib/services/oauth2.js b/lib/services/oauth2.js index b6210ee..f0cc807 100644 --- a/lib/services/oauth2.js +++ b/lib/services/oauth2.js @@ -8,7 +8,8 @@ function OAuth2(options){ // This option is necessary when the Oauth service has a self-signed cert. // Hopefully this is only set to false in the safety of testing but not out in the wild. this.rejectUnauthorizedRequests = !(options && options.rejectUnauthorized == false); - + this.host = options.host || null; + EventEmitter.call(this); } @@ -19,7 +20,9 @@ OAuth2.prototype.parseURI = function(request) { , secure = request.connection.encrypted || proto == "https" , protocol = secure ? "https" : "http" , host = request.headers.host || request.connection.remoteAddress - + + if (this.host) host = this.host; + return url.parse(protocol + "://" + host + request.url, true) }