Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Oauth implementation using Groovy Script Runner

raj-kumar2
Contributor
March 2, 2020

Hi,

We are working on integrating Jira with Workday. We have got Client ID, Key and Authorization url from Workday and need to implement OAuth authentication using Groovy.

Can you please share the code to setup Oauth2.0 authentication by using Groovy? Or is there any other method from Jira we can use to implement Oauth?

Regards,

Raj

1 answer

0 votes
PD Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 3, 2020

Hi @raj-kumar2 

Can't you just add Workday as a generic application link with OAuth in the JIra Application Links Configuration?

Then you can just leverage the application link object in groovy.

Something along these lines:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.applinks.JiraApplicationLinkService
import com.atlassian.sal.api.net.Response
import com.atlassian.sal.api.net.ResponseException
import com.atlassian.sal.api.net.ResponseHandler
import com.atlassian.sal.api.net.Request.MethodType

def appLinkService = ComponentAccessor.getComponent(JiraApplicationLinkService.class)
def appLink = appLinkService.getApplicationLinks().find{it.name == 'Workday'}
def appLinkRequestFactory = appLink.createAuthenticatedRequestFactory()
def request = appLinkRequestFactory.createRequest(MethodType.POST, 'workday/endpoint')

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events