Could not send [createIssue] action to Jira [JiraSoftware]. Reason: 401 Unauthorized
Asked by serge calderara:

Dear all,

I have setup Jira Software integration within Opsgenie in order that when an alert is created in opsgenie then it also create an Issue in a jira project

I have provide all information with issue type, URL, project key, user and password

But doing so I all type gets the error in activity log :

Could not send \[createIssue\] action to Jira \[JiraSoftware\]. Reason: 401 Unauthorized

If I create the issue directly in Jira with same user and password define in the integration, then I can create the issue which means that the provided user/passw has proper perimission.

What is missing here any idea ?

regards


Answers:
author: Nick H
body: Hi [@serge calderara](/t5/user/viewprofilepage/user-id/3385932) ,

This community article should help troubleshoot the error: <https://community.atlassian.com/t5/Opsgenie-articles/Opsgenie-Alerts-Not-Creating-Jira-Jira-Service-Management-Issues/ba-p/1563628>

A 401 is typically an authorization issue so you will want to use a Jira API token (and only the token) in the password field of the integration.

Hope this helps! Let us know if you run into any other questions or issues after trying this.

comments: author: serge calderara
body: HI [@Nick H](/t5/user/viewprofilepage/user-id/2540930) , usually for automation process, we use an internal account dedicated to that which is user: **jira_automation** ( with admin rights ) and its password

Then all automation process gets executed by this account

Now when you talk about API token, from where should I create this API token in order that it is linked to this automation internal account ?

regards


author: Nick H
body: There should be an API token link in that community post I shared above, but here it is as well: <https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/>

Users can create API tokens by navigating within Jira or JSM to:

Profile \>\> Manage your account \>\> Security \>\> API Tokens \>\> [Create and manage API tokens](https://id.atlassian.com/manage-profile/security/api-tokens) \>\> Create API token \>\> then copy/paste new API Token into the integration's password field.


author: serge calderara
body: hello [@Nick H](/t5/user/viewprofilepage/user-id/2540930) got it, I am able to create the issue in Jira while the alert arrive in opsgenie.

But then what is wierd is that it mapped the Jira issue inside an extra property named IssueKey.

Any idea how to get the issue key appears as a link to the alert as shown below :

![Tm1Vz27HpN.png](https://community.atlassian.com/t5/image/serverpage/image-id/142847i6F3463DB4432A54F/image-size/large?v=v2&px=999 "Tm1Vz27HpN.png")


author: Nick H
body: To add a link back to the issue, you'd want to add something like:

[https://accountname.atlassian.net/browse/{{key}](https://hello.atlassian.net/wiki/spaces/~650444395/pages/843670359/Opsgenie+Cheat+Sheet# "#")}

into an alert field of the Create Alert action(s):

![commjira1.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/142853i8D0FE407E5F54017/image-size/large?v=v2&px=999 "commjira1.jpg")

Example:

![commjira2.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/142852i3AA55EBF75EFEAA3/image-size/large?v=v2&px=999 "commjira2.jpg")


author: serge calderara
body: hello [@Nick H](/t5/user/viewprofilepage/user-id/2540930) , I have try to do same as you mentionned but the Issue Link is not appearing on my side

![8WBGJUl630.png](https://community.atlassian.com/t5/image/serverpage/image-id/142855iAC37470B83614191/image-size/large?v=v2&px=999 "8WBGJUl630.png")![u9pfDK1BYb.png](https://community.atlassian.com/t5/image/serverpage/image-id/142856iB0F520D76555592C/image-size/large?v=v2&px=999 "u9pfDK1BYb.png")

Any idea what I am missing ?


author: Nick H
body: I apologize. I thought you were asking how to a link back to the issue when a Jira issue creates an Opsgenie alert.

At this time it's not possible to link back to the Jira issue when an Opsgenie alert creates the Jira issue.

We have a feature request for this I can add you to.

In the meantime, you'd have to link the issue manually here:

![commjira4.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/142858iAA83DA107C7ABE5E/image-size/large?v=v2&px=999 "commjira4.jpg")


author: serge calderara
body: hello [@Nick H](/t5/user/viewprofilepage/user-id/2540930) , as the link back cannot be create in opsgenie when opsgenie create a jira issue when an alert is created, then is there a way to do it in oposite whay in the sense that :

When opgenie create the Alert, it then create automatically the issue in Jira and the Issue in Jira can have a field which contains the Alert url ?

Possible in that direction ?

regards

serge