Skip to content

Commit 2dcaa6f

Browse files
authored
Add JiraApiWithOptions documentation in the README.md
1 parent edcf0e1 commit 2dcaa6f

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,37 @@ or
2929

3030
### Create the JIRA client ###
3131

32+
#### Create a simple JIRA client ####
33+
3234
JiraApi = require('jira').JiraApi;
3335

3436
var jira = new JiraApi('https', config.host, config.port, config.user, config.password, '2.0.alpha1');
3537

38+
#### Need special HTTP settings ####
39+
40+
In the case of, if some particular settings are needed to sign in like proxy authentication, for example. This can be done by passing the HTTP request options as parameter of the jiraApiWithOptions method.
41+
42+
const HttpProxyAgent = require("http-proxy-agent");
43+
const agent = new HttpProxyAgent("http://proxy");
44+
const options = {
45+
"agent": agent, // proxy setting
46+
rejectUnauthorized: this.strictSSL, // strict ssl option
47+
headers: {
48+
"Proxy-Authorization": "Bearer authentication_token", // proxy authentification
49+
"Authorization": 'Basic ' + Buffer.from(username + ':' + password).toString('base64') // basic authentication
50+
},
51+
oauth: { // in the case of oauth instead of basic
52+
consumer_key: oauth.consumer_key,
53+
consumer_secret: oauth.consumer_secret,
54+
token: oauth.access_token,
55+
token_secret: oauth.access_token_secret
56+
}
57+
}
58+
JiraApiWithOptions = require('jira').JiraApiWithOptions;
59+
60+
var jira = new JiraApiWithOptions('https', 'server.com', '443', '2.0.alpha1', true, 'jira', options);
61+
62+
3663
### Find the status of an issue ###
3764

3865
jira.findIssue(issueNumber, function(error, issue) {

0 commit comments

Comments
 (0)