gapitoken-generic
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -17,19 +17,19 @@ var https = require('https'); | ||
this.port = options.port; | ||
this.grant = encodeURIComponent(options.grant) || 'urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer'; | ||
this.grant = options.grant || 'urn:ietf:params:oauth:grant-type:jwt-bearer'; | ||
if (options.keyFile) { | ||
var self = this; | ||
process.nextTick(function() { | ||
fs.readFile(options.keyFile, function(err, res) { | ||
if (err) { return callback(err); } | ||
self.key = res; | ||
callback(); | ||
}); | ||
}); | ||
} else if (options.key) { | ||
this.key = options.key; | ||
process.nextTick(callback); | ||
} else { | ||
callback(new Error("Missing key, key or keyFile option must be provided!")); | ||
} | ||
if (options.keyFile) { | ||
var self = this; | ||
process.nextTick(function() { | ||
fs.readFile(options.keyFile, function(err, res) { | ||
if (err) { return callback(err); } | ||
self.key = res; | ||
callback(); | ||
}); | ||
}); | ||
} else if (options.key) { | ||
this.key = options.key; | ||
process.nextTick(callback); | ||
} else { | ||
callback(new Error("Missing key, key or keyFile option must be provided!")); | ||
} | ||
}; | ||
@@ -68,3 +68,3 @@ | ||
var post_data = 'grant_type=' + this.grant + '&assertion=' + signedJWT; | ||
var post_data = 'grant_type=' + encodeURIComponent(this.grant) + '&assertion=' + signedJWT; | ||
var post_options = { | ||
@@ -71,0 +71,0 @@ host: this.host, |
{ | ||
"name": "gapitoken-generic", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Node.js module for Google-compatible API service account authorization (Server to Server flow)", | ||
@@ -5,0 +5,0 @@ "main": "gapitoken.js", |
5807