jira-connector
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -116,2 +116,3 @@ "use strict"; | ||
* @param {string} [config.oauth.token_secret] The secret for the above token. MUST be included if using Oauth. | ||
* @param {CookieJar} [config.cookie_jar] The CookieJar to use for every requests. | ||
*/ | ||
@@ -155,2 +156,6 @@ var JiraClient = module.exports = function (config) { | ||
if (config.cookie_jar) { | ||
this.cookie_jar = config.cookie_jar; | ||
} | ||
this.issue = new issue(this); | ||
@@ -236,2 +241,5 @@ this.applicationProperties = new applicationProperties(this); | ||
} | ||
if (this.cookie_jar) { | ||
options.jar = this.cookie_jar; | ||
} | ||
request(options, function (err, response, body) { | ||
@@ -238,0 +246,0 @@ if (err || response.statusCode.toString()[0] != 2) { |
{ | ||
"name": "jira-connector", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Easy to use NodeJS wrapper for the Jira REST API.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -190,2 +190,40 @@ # JavaScript Jira API Wrapper for NodeJS | ||
### Cookie Jar | ||
You can also use a Cookie Jar for your request. It could be an easier way to prompt for a login only once, without the | ||
pain of setting up an OAuth method. | ||
For example, using `though-cookie-filestore`: | ||
```javascript | ||
var JiraClient = require('../jira-connector'), | ||
FileCookieStore = require('tough-cookie-filestore'), | ||
request = require('request'), | ||
path = require('path'); | ||
var jar = request.jar(new FileCookieStore(path.join(__dirname, 'cookies.json'))); | ||
// For the first connection | ||
var jira = new JiraClient( { | ||
host: 'jenjinstudios.atlassian.net', | ||
basic_auth: { | ||
username: 'SirUserOfName', | ||
password: 'Password123' | ||
}, | ||
cookie_jar: jar | ||
}); | ||
// For the following connections | ||
var jira = new JiraClient( { | ||
host: 'jenjinstudios.atlassian.net', | ||
cookie_jar: jar | ||
}); | ||
``` | ||
In this example, all your cookies are save in a file, `cookies.json`. Currently, the file **MUST** exist, it's a | ||
limitation from `though-cookie-filestore`... | ||
You can now only use the Cookie Jar for all the following request, as long as the file exists and the cookie | ||
is still valid! | ||
## Supported API Calls | ||
@@ -192,0 +230,0 @@ |
234503
5121
468