I'm trying to create a Jira issue when a step fails in a Bitbucket pipeline. I use the "Jira Create Issue" pipe version 0.8.1. For the $JIRA_API_TOKEN, I generated an API token from https://id.atlassian.com/manage-profile/security/api-tokens for Jira with scope "write:jira-work". And used it in the step. But "Jira Create Issue" step is failing with the following error.
✖ Failed to initialize a Jira client for https://<company>.atlassian.net
ERROR: You are not authenticated. Authentication required to perform this operation.
Any idea how I can fix this?
Hi Nuwan Naththandige,
Welcome to the Atlassian community.
Have you also defined the "JIRA_USER" variable? The pipe doesn't just need the token; it needs to know who the token belongs to. Also, the JIRA_API_TOKEN should be marked as Secured. If it is not secured, the pipe won't be able to "see" it during the runtime.
Can you "curl" it? Have you been running this locally in your terminal to see if the token works outside of Bitbucket and returns a 200 OK?
curl -D- -u your-email@company.com:YOUR_TOKEN_HERE -X GET -H "Content-Type: application/json" https://<company>.atlassian.net/rest/api/3/myself
Cheers,
Martin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.