4

I am banging my head against the wall from the last couple of weeks to just set up the authentication between JIRA cloud and salesforce, I didn't get any proper documentation to create a connected application in Jira to generate client Id and secret so that I can set up an auth provider in salesforce to use it with the named credentials, if I am not following the right path, please feel free to correct me. In one of my unsuccessful attempts, I tried to generate OAuth credentials (currently in beta in Jira) and used the same in AUTH provider in salesforce but still, when I save named credentials I get identity provider error and also I am not sure on what exactly I need to pass for Authorization Endpoint URL and Token End Point URL I would highly appreciate if someone would help me to generate client id secret from JIRA other then generating the same by clicking on generate OAuth credentials button on Jira as this has limited access and also I would be very grateful if someone also helps me with Authorization Endpoint URL and Token End Point URL

here is my Auth provider

Auth provider

Named Credentials:

enter image description here

And when I save the named credentials I get below error

enter image description here

I have generated client id secret by clicking on OAuth credentials beta and this doesn't seem the right way to generate client id and secret as it is in beta and provides only limited access.

JIRA Documentation is not at all helpful.

enter image description here

If I generate my client id and secret from the below link

https://developer.atlassian.com/apps/

then I get a different error as shown below.

enter image description here

4

3 Answers 3

4

I was able to authenticate my OAuth 2.0 with the following configuration. enter image description here

enter image description here

For the Auth. provider my Endpoint URL was:

https://auth.atlassian.com/authorize?audience=api.atlassian.com

My token endpoint was

https://auth.atlassian.com/oauth/token

My default scopes were:

read:jira-work manage:jira-project manage:jira-configuration read:jira-user write:jira-work manage:jira-data-provide offline_access

Also I made sure that the callback url in my Jira app was the same callback url in the Auth. provider (https://developer.atlassian.com/cloud/jira/platform/oauth-2-authorization-code-grants-3lo-for-apps/?_ga=2.21088251.1341824495.1591632254-1686398826.1589413008 for more info on Jira App)

I used the Auth. Provider in my Named credential and made sure to keep Scope empty so it would use the default scope in the Auth Provider.

Turning off "Generate Authorization Header" helped for my API calls to not return 401 during my tests.

Unfortunately I still don't see the issues on my Jira when I do API calls but I hope this helps you get closer to solving your problem.

5
  • Thank you so much for your kind help, finally authenticated successfully, and just to clarify your last line, are you able to make API call or getting an issue.
    – gs650x
    Commented Jun 10, 2020 at 4:31
  • I have created another thread for issue in callout, if you are not getting any issue then please suggest, salesforce.stackexchange.com/questions/308964/…
    – gs650x
    Commented Jun 10, 2020 at 7:17
  • When i do the GET api callout to "callout:JiraOauth/rest/api/3/search" i get the response "{"startAt":0, "maxResults":50, "total":0 "issues":[]}" when i actually except the api call to return the issues on my Jira
    – vdrizzle
    Commented Jun 10, 2020 at 16:42
  • I don't know why but I am getting 401 for this.*callout:JiraOauth/rest/api/3/search* Client must be authenticated to access this resource, but my named credentials status is authenticated.
    – gs650x
    Commented Jun 10, 2020 at 17:08
  • This probably isn't helpful but I get "{"startAt":0, "maxResults":50, "total":0 "issues":[]}" when i disable "Generate Authorization Header" in Named Crendtials, otherwise I get the same error as you
    – vdrizzle
    Commented Jun 10, 2020 at 22:22
0

All authentication details for Jira are mentioned in their documentation. Hope the below will help to put you in the right path. You will also need to create an Auth Provider and link it to your named credential.

Jira Cloud :
https://developer.atlassian.com/cloud/jira/platform/basic-auth-for-rest-apis/

oAuth :
https://developer.atlassian.com/cloud/jira/platform/oauth-2-authorization-code-grants-3lo-for-apps/#authcode

The Authorization Endpoint URL :

https://auth.atlassian.com/authorize

Token End Point URL

https://auth.atlassian.com/oauth/token
1
  • Thank you for your answer and I am trying to follow these documentation and I still stuck with the same issue, I have updated my question with screenshot.
    – gs650x
    Commented Jun 8, 2020 at 4:09
-1
  1. Remove default scope from Salesforce Auth Provider . Alternatively you can set it to the scope defined in JIRA. Right now I can see it set to ADMIN. Verify and replace.

  2. Provide the correct callback URL in JIRA Oauth screen. This should be the Salesforce URL that get redirected to on correct authentication/authorization.

5
  • Thank you for your answer, I removed default scope from Auth provider but still not able to authenticate and as per my knowledge I am providing correct Authorization end point URL rest I am not sure, please suggest
    – gs650x
    Commented Jun 8, 2020 at 14:02
  • Along with Default Scope, clear off the URL Suffix, Token Issuer
    – user40322
    Commented Jun 8, 2020 at 14:23
  • URL Suffix and Token Endpoint URL both are required fields.
    – gs650x
    Commented Jun 8, 2020 at 14:26
  • You can leave URL Suffix, other field which I mentioned earlier was Token Issuer and not Token Endpoint URL. Keep scope blank
    – user40322
    Commented Jun 8, 2020 at 14:48
  • I am sorry for the misunderstanding, I have updated Auth provider as you explained removed default scope and token issuer and add the updated auth provider screenshot on my question, but still the issue is same.
    – gs650x
    Commented Jun 8, 2020 at 15:06

Not the answer you're looking for? Browse other questions tagged .