Skip to content

Connecting with Cookie‐Based Auth

Robert Brodie edited this page Apr 27, 2024 · 2 revisions

Jira supports cookie based authentication whereby user credentials are passed to Jira via a Jira REST API call. This call returns a session cookie which must then be sent to all following JIRA REST API calls.

Configuring Your Client

To enable cookie based authentication, set :auth_type to :cookie, set :use_cookies to true and set :username and :password accordingly.

options = {
  :username           => '<Your username>',
  :password           => '<Your password>',
  :site               => 'https://<subdomain>.atlassian.net/',
  :context_path       => '',
  :auth_type          => :cookie,  # Set cookie based authentication
  :use_cookies        => true,     # Send cookies with each request
  :additional_cookies => ['AUTH=vV7uzixt0SScJKg7'] # Optional cookies to send
                                                   # with each request
}

client = JIRA::Client.new(options)

Notes

  • Some authentication schemes might require additional cookies to be sent with each request. Cookies added to the :additional_cookies option will be added to each request. This option should be an array of strings representing each cookie to add to the request.
  • Some authentication schemes that require additional cookies ignore the username and password sent in the Jira REST API call. For those use cases, :username and :password may be omitted from options.