How to authenticate with JIRA Steps plugin in Jenkins after basic auth deprecation

I’m trying to set up ticket creation through Jenkins using the JIRA Steps plugin, but I’m running into authentication issues. Since JIRA has disabled basic authentication for their APIs, I’m not sure what credentials I should be using in the configuration.

I’ve been working with this setup but keep getting authentication errors. Here’s my current pipeline code:

node {
  stage('CreateTicket') {
    withEnv(['JIRA_SITE=MyJira']) {
      def newTicket = [fields: [ project: [key: 'PROJ'],
                                summary: 'Automated ticket creation',
                                issuetype: [name: 'Task']]]

      result = jiraNewIssue issue: newTicket
      echo result.successful.toString()
      echo result.data.toString()
    }
  }
}

What type of authentication should I configure in Jenkins for the JIRA connection now that basic auth is deprecated? Should I be using API tokens or some other method? Any help would be appreciated.

You need to set up API token auth in your Jenkins JIRA config. Go to your Atlassian account settings > Security and generate an API token. Then in Jenkins, hit Manage Jenkins > Configure System and find your JIRA setup. Use your regular JIRA email as username and paste that token as the password. Test the connection after saving. I had the same auth failures until I figured out the token needs full read/write permissions based on what your pipeline does. Your pipeline code looks fine - this is definitely a credential setup issue, not the API calls.

Had this exact problem recently and wasted way too much time on it. Your API token setup looks right, but here’s what got me - make sure you’re generating the token from your Atlassian account profile, not from inside Jira itself (if you’re on Jira Cloud). Also double-check that your Jenkins global config has the JIRA site name matching exactly what’s in your withEnv block. I kept getting 401s because of case sensitivity with the site name. Fixed that mismatch and everything worked.

yep, api tokens are the way to go now that basic auth is dead. just head to your atlassian account, create a token, and use your email as the username with the token as your password in jenkins. it worked like a charm for me after the basic auth removal.