Last active
June 7, 2017 19:17
-
-
Save PaulMougel/c2cbd337af98b5b36a50c84c33ac5e0b to your computer and use it in GitHub Desktop.
How to use bell for JIRA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// You'll need to create a hapi.js server | |
// | |
// For more information about tokens, check | |
// https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-oauth-authentication | |
var jiraStrategy = require('./jira.strategy'); | |
server.auth.strategy('jira', 'bell', { | |
provider: strategy('https://xxx.atlassian.net'), | |
password: 'COOKIE-PASSWORD', | |
clientId: 'CLIENT-ID', | |
clientSecret: 'CLIENT-SECRET' | |
}); | |
server.route({ | |
method: '*', | |
path: '/bell/jira', | |
config: { | |
auth: { | |
strategy: 'jira', | |
mode: 'try' | |
}, | |
handler: function (request, reply) { | |
reply(request.auth); | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (baseUrl) { | |
return { | |
protocol: 'oauth', | |
auth: baseUrl + '/plugins/servlet/oauth/authorize', | |
token: baseUrl + '/plugins/servlet/oauth/access-token', | |
temporary: baseUrl + '/plugins/servlet/oauth/request-token', | |
signatureMethod: 'RSA-SHA1', | |
profile: function (credentials, params, get, callback) { | |
get(baseUrl + '/rest/api/2/myself', {}, function (profile) { | |
credentials.profile = profile; | |
callback(); | |
}); | |
} | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment