Basic auth for REST APIs (2024)

This page shows you how REST clients can authenticate themselves usingbasic authentication with an Atlassian account email addressand API token.Authentication using passwords has been deprecated.

Basic authentication is not as secure as other methods. We recommend using it for simple scripts andmanual calls to the REST APIs. Otherwise, consider building an app:

Overview

The Jira REST API is protected by the same restrictions that apply in the standard Jira web interface.These restrictions mean that if you don't log in, you access Jira anonymously. If you log in and don'thave permission to view something in Jira, you won't be able to view it using the Jira REST API either.

In most cases, the first step in using the Jira REST API is to authenticate a user account with yourJira site. This page provides a simple example of basic authentication.

Get an API token

Basic auth requires API tokens. You generate an API token for your Atlassian account and useit to authenticate anywhere where you would have used a password. This enhances security because:

  • you're not saving your primary account password outside of where you authenticate
  • you can quickly revoke individual API tokens on a per-use basis
  • API tokens will allow you to authenticate even if your Atlassian Cloud organization has two-factorauthentication or SAML enabled.

See the Atlassian Cloud Support API tokens article to discoverhow to generate an API token.

Simple example

Most client software provides a simple mechanism for supplying a user name (in our case, the email address)and API token that the client uses to build the required authentication headers. For example, you canspecify the -u argument in cURL as follows:

12
curl -D- \ -u fred@example.com:freds_api_token \ -X GET \ -H "Content-Type: application/json" \ https://your-domain.atlassian.net/rest/api/2/issue/createmeta

Supply basic auth headers

You can construct and send basic auth headers. To do this you perform the following steps:

  1. Generate an API token for Jira using your Atlassian Account.
  2. Build a string of the form useremail:api_token.
  3. BASE64 encode the string.
    • Linux/Unix/MacOS:
      12
      echo -n user@example.com:api_token_string | base64
    • Windows 7 and later, using Microsoft Powershell:
      12
      $Text = ‘user@example.com:api_token_string’$Bytes = [System.Text.Encoding]::UTF8.GetBytes($Text)$EncodedText = [Convert]::ToBase64String($Bytes)$EncodedText
  4. Supply an Authorization header with content Basic followed by the encoded string. For example, the string fred:fred encodes to ZnJlZDpmcmVk in base64, so you would make the request as follows:
12
curl -D- \ -X GET \ -H "Authorization: Basic ZnJlZDpmcmVk" \ -H "Content-Type: application/json" \ "https://your-domain.atlassian.net/rest/api/2/issue/QA-31"

Advanced topics

Authentication challenges

Because Jira permits a default level of access to anonymous users, it does not supply an authenticationchallenge. Some HTTP clients expect to receive an authentication challenge before they sendan authorization header. This means that a client may not behave as expected. In this case,configure the client to supply the authorization header, as described above, rather thanrelying on its default mechanism.

CAPTCHA

A CAPTCHA is 'triggered' after several consecutive failed log in attempts, and requires the user tointerpret a distorted picture of a word and type that word into a text field with each subsequent login attempt. If CAPTCHA has been triggered, you cannot use Jira's REST API to authenticate with the Jira site.

You can check this in the error response from Jira. If there is an X-Seraph-LoginReason header witha value of AUTHENTICATION_DENIED, the application rejected the login without even checking the password.This is the most common indication that Jira's CAPTCHA feature has been triggered.

Basic auth for REST APIs (2024)
Top Articles
Here's How Netflix Can Now Improve Your Credit Score
Leaving Your Home for Extended Periods of Time - Crystal Flash
Navicent Human Resources Phone Number
Jordanbush Only Fans
Tmf Saul's Investing Discussions
Craigslist Cars And Trucks For Sale By Owner Indianapolis
Crocodile Tears - Quest
Kansas Craigslist Free Stuff
7543460065
Ou Class Nav
Hijab Hookup Trendy
Katherine Croan Ewald
Icommerce Agent
Voy Boards Miss America
Libinick
Saritaprivate
Music Go Round Music Store
Selfservice Bright Lending
Gazette Obituary Colorado Springs
Craigslistodessa
Rs3 Ushabti
Which Sentence is Punctuated Correctly?
Cookie Clicker Advanced Method Unblocked
Craigslist Ludington Michigan
Busted Mugshots Paducah Ky
Radical Red Ability Pill
Miles City Montana Craigslist
Criglist Miami
Ncal Kaiser Online Pay
Meowiarty Puzzle
Housing Intranet Unt
Jeep Cherokee For Sale By Owner Craigslist
Cars And Trucks Facebook
Old Peterbilt For Sale Craigslist
Why The Boogeyman Is Rated PG-13
Myfxbook Historical Data
Rhode Island High School Sports News & Headlines| Providence Journal
Lake Kingdom Moon 31
Jetblue 1919
1Exquisitetaste
Jamesbonchai
Tinfoil Unable To Start Software 2022
22 Golden Rules for Fitness Beginners – Barnes Corner Fitness
Child care centers take steps to avoid COVID-19 shutdowns; some require masks for kids
Wpne Tv Schedule
Steam Input Per Game Setting
O'reilly's On Marbach
David Turner Evangelist Net Worth
King Fields Mortuary
When Is The First Cold Front In Florida 2022
Syrie Funeral Home Obituary
Latest Posts
Article information

Author: Arielle Torp

Last Updated:

Views: 6376

Rating: 4 / 5 (61 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Arielle Torp

Birthday: 1997-09-20

Address: 87313 Erdman Vista, North Dustinborough, WA 37563

Phone: +97216742823598

Job: Central Technology Officer

Hobby: Taekwondo, Macrame, Foreign language learning, Kite flying, Cooking, Skiing, Computer programming

Introduction: My name is Arielle Torp, I am a comfortable, kind, zealous, lovely, jolly, colorful, adventurous person who loves writing and wants to share my knowledge and understanding with you.