Summary
This article describes how to configure an OAuth app (3LO) in Jira App management, token generation and configuring an account in webMethods.io workflow
Prerequisites
- User must have a Jira Instance and an account created in that instance.
- Working webMethods.io tenant.
Contents
- Create an OAuth App in Jira App management
- Generate an Access Token and Refresh Token using a REST client
- Configuring an OAuth Jira Account in webMethods.io workflow
Steps
-
Login to Log in with Atlassian account
-
Click on “Create New App” on the top right corner
-
Name your app and tick the checkbox “I agree to be bound by Atlassian’s developer terms.”
-
Click on “Add” and add all the APIs required.
For our use case we need to add “Jira Service Desk API” and “Jira Platform REST API”
-
Select API from “APIs and Features” on left pane and add all the scopes required.
-
Select “OAuth 2.0 (3LO)” from “APIs and Features” on the left pane and add callback URL and save changes.
For our use case add https://tech.forums.softwareag.com as a callback URL
-
Get Authorization code
https://auth.atlassian.com/authorize?audience=api.atlassian.com&client_id=YOUR_CLIENT_ID&scope=REQUESTED_SCOPE_ONE%20REQUESTED_SCOPE_TWO&redirect_uri=https://YOUR_APP_CALLBACK_URL&state=YOUR_USER_BOUND_VALUE&response_type=code&prompt=consent
Where,
- client_id and client_secret → Create an app from App Management and get the client_id and client_secret
- scope: separate scope by appending %20
Add “offline_access” to get refresh_token in next step
Recommended scopes: manage%3Aservicedesk-customer%20read%3Aservicedesk-request%20write%3Aservicedesk-request%20read%3Ajira-user%20read%3Ajira-work%20manage%3Ajira-project%20manage%3Ajira-configuration%20write%3Ajira-work%20manage%3Ajira-data-provider%20offline_access (This will get access token for both Jira software and Jira Service desk )
- redirect_uri = set same redirect URI which is set in the App created
- state = set some random number which can’t be guessed by anyone to get access token
ex: 494954955989
(Read documentation for more details https://developer.atlassian.com/cloud/jira/platform/oauth-2-authorization-code-grants-3lo-for-apps/#faq3 )
- response_type = code
- prompt = consent
Form the URL and enter it in any browser and authorize to get the code by clicking accept.
Since the redirect URI was https://tech.forums.softwareag.com/ it’s redirected us to Software AG Tech Forums with our code.
Code can be found in the URL as query string parameter.
- Get Access Token and Refresh Token
Make a POST call from POSTMAN
https://auth.atlassian.com/oauth/token
body:
grant_type = authorization_code
client_id = Create an app from App Management and get the client_id
client_secret = Create an app from App Management and get the client_secret
code = Code obtained from step 7 (Get Authorization code)
redirect_uri = set same redirect URI which is set in the App created
- Get New Access Token using Refresh Token
Make a POST call from POSTMAN
https://auth.atlassian.com/oauth/token
body:
grant_type = refresh_token
client_id = Create an app from App Management and get the client_id
client_secret = Create an app from App Management and get the client_secret
refresh_token = Obtained from step 8 ( Get Access_token and refresh_token )
- Get cloud id and accessible resources.
Make a GET call from POSTMAN
https://api.atlassian.com/oauth/token/accessible-resources
body:
Authorization = Bearer "Obtained access_token"
Accept = application/json
- Login to webMethods.io and select webMethods.io Integration.
- Create a new project or you can select an existing project if required.
- Select workflows and add a new workflow
- Drag and drop Atlassian Jira connector from the connectors palate and name your workflow
- Click on the setting icon which appears when u hover on Atlassian Jira connector
- Click on “Add Custom Action”
- Select authentication type “OAuth V2.0 (Authorization Code Flow)”
- Fill in the details and click add
Details:
Client ID, Client secret, Access Token, Refresh Token, Refresh URL
Grant type = refresh_token
Server URL = https://api.atlassian.com/ex/jira/<cloud-id>
Where <Cloud-id> is obtained from step 10
- Create custom action, connect the connector to stop icon
Save the workflow and click the play button to run the workflow.
#oauth#connectors#Jira#Integration-Server-and-ESB#webMethods#CloudStreams