How to configure an OAuth app in Jira App management and OAuth account in webMethods.io

 View Only
Thu February 17, 2022 10:50 PM

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

  1. Login to Log in with Atlassian account

  2. Click on “Create New App” on the top right corner

  3. Name your app and tick the checkbox “I agree to be bound by Atlassian’s developer terms.”

  4. 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”

  5. Select API from “APIs and Features” on left pane and add all the scopes required.

  6. 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

  7. 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.

  1. 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

  1. 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 )

  1. 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

  1. Login to webMethods.io and select webMethods.io Integration.
  2. Create a new project or you can select an existing project if required.
  3. Select workflows and add a new workflow

  1. Drag and drop Atlassian Jira connector from the connectors palate and name your workflow

  1. Click on the setting icon which appears when u hover on Atlassian Jira connector

  1. Click on “Add Custom Action”

  1. Select authentication type “OAuth V2.0 (Authorization Code Flow)”

  1. 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

  1. 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

Comments

Tue June 21, 2022 06:52 AM

Hi,

I always get the following error message “Unknown or invalid refresh token” after a certain time. With Postman everything works without problems. What could be the problem?

Thanks. Regards,
Yannick


#oauth
#webMethods
#CloudStreams
#Jira
#connectors
#Integration-Server-and-ESB

Tue February 22, 2022 07:06 AM

Updated label to knowledge base.

Regards,
Bharath


#connectors
#Integration-Server-and-ESB
#CloudStreams
#oauth
#webMethods
#Jira