Join 34,000+ subscribers and receive articles from our
blog about software quality, testing, QA and security.

JIRA authenticate failed


#1

I am receiving authentication failed. I have verified my username and password is correct. When I paste the link in a browser I see the JSON file. When I enable debug logs I notice that it says ‘X-AUSERNAME: anonymous
’. Shouldn’t it username be the same as my jira login?

Also the “Authorization: Basic” correct decodes to my username/password. Below is debug loged (edited to remove websites)

[D] 2017-06-04 21:13:48 [112ms]: <id:23824837> Query took 0.51 ms (at Database_driver->_after_query)
[D] 2017-06-04 21:13:48 [126ms]: <id:23824837> Issuing Jira HTTP REST request (at Jira_REST_api->_send_request)
[D] 2017-06-04 21:13:48 [126ms]: <id:23824837> $request = Array
(
    [method] => GET
    [url] => https://eng.work-web-site.com/jira/rest/api/2/issue/IFKDP-13
    [data] =>
)
 (at Jira_REST_api->_send_request)
[D] 2017-06-04 21:13:48 [160ms]: <id:23824837> Got the following response (at Jira_REST_api->_send_request)
[D] 2017-06-04 21:13:48 [160ms]: <id:23824837> $response = stdClass Object
(
    [code] => 401
    [log] => Array
        (
            [info] => Array
                (
                    [url] => https://eng.work-web-site.com/jira/rest/api/2/issue/IFKDP-13
                    [content_type] => application/json;charset=UTF-8
                    [http_code] => 401
                    [header_size] => 540
                    [request_size] => 171
                    [filetime] => -1
                    [ssl_verify_result] => 0
                    [redirect_count] => 0
                    [total_time] => 0.033217
                    [namelookup_time] => 0.00429
                    [connect_time] => 0.005042
                    [pretransfer_time] => 0.025232
                    [size_upload] => 0
                    [size_download] => 109
                    [speed_download] => 3281
                    [speed_upload] => 0
                    [download_content_length] => -1
                    [upload_content_length] => -1
                    [starttransfer_time] => 0.033003
                    [redirect_time] => 0
                    [redirect_url] =>
                    [primary_ip] => 192.168.100.254
                    [certinfo] => Array
                        (
                        )

                    [primary_port] => 443
                    [local_ip] => 192.168.100.10
                    [local_port] => 42086
                    [request_header] => GET /jira/rest/api/2/issue/IFKDP-13 HTTP/1.1
Host: eng.work-web-site.com
Authorization: Basic XXXXXXXXXXXXXXXXXXXXXXXXXXXX
Accept: */*
Content-Type: application/json


                )

            [raw] => HTTP/1.1 401 Unauthorized
Date: Mon, 05 Jun 2017 01:11:27 GMT
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips
X-AREQUESTID: 1273x66203x1
X-ASEN: SEN-9325534
Set-Cookie: atlassian.xsrf.token=BDOQ-S5LC-AQLR-34XL|ea3dfd069ad8de7eb48a3891bfc08aacecf66d7c|lout; Path=/jira; Secure
X-AUSERNAME: anonymous
Cache-Control: no-cache, no-store, no-transform
X-Content-Type-Options: nosniff
WWW-Authenticate: OAuth realm="https%3A%2F%2Feng.work-web-site.com%2Fjira"
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked

{"errorMessages":["You do not have the permission to see the specified issue.","Login Required"],"errors":{}}
        )

    [content] => {"errorMessages":["You do not have the permission to see the specified issue.","Login Required"],"errors":{}}
    [headers] => Array
        (
            [Date] => Mon, 05 Jun 2017 01:11:27 GMT
            [Server] => Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips
            [X-AREQUESTID] => 1273x66203x1
            [X-ASEN] => SEN-9325534
            [X-AUSERNAME] => anonymous
            [Cache-Control] => no-cache, no-store, no-transform
            [X-Content-Type-Options] => nosniff
            [WWW-Authenticate] => OAuth realm="https%3A%2F%2Feng.work-web-site.com%2Fjira"
            [Content-Type] => application/json;charset=UTF-8
            [Transfer-Encoding] => chunked
        )

    [cookies] => Array
        (
            [atlassian.xsrf.token] => BDOQ-S5LC-AQLR-34XL|ea3dfd069ad8de7eb48a3891bfc08aacecf66d7c|lout
        )

)
 (at Jira_REST_api->_send_request)
[E] 2017-06-04 21:13:48 [161ms]: [Jira_RESTException] Invalid user or password or insufficient permissions for the integration user (HTTP code 401). Please make sure to use your actual JIRA username for the integration (not your email address, for example).
---
Details: <missing>
File: /opt/testrail/www/testrail/app/plugins/defects/Jira_REST.php
Line: 1868
Status Code: 500
Host: 10.1.0.37
Uri: /index.php?/defects/ajax_lookup (POST)
---
Browser: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0
PHP: 5.6.30-11+deb.sury.org~xenial+3
Server: Linux 4.4.0-78-generic #99-Ubuntu SMP Thu Apr 27 15:29:09 UTC 2017 x86_64
---
project_id: 5
defect_id: IFKDP-13
_token: V33D3L9wSmMo.gu/Av07
_version: 5.3.0.3603
---
Trace:
at Jira_REST_api->_throw_error (Jira_REST.php:1503)
at Jira_REST_api->_send_request (Jira_REST.php:1444)
at Jira_REST_api->_send_command (Jira_REST.php:1438)
at Jira_REST_api->get_issue (Jira_REST.php:805)
at Jira_REST_defect_plugin->lookup (defects.php:1185)
at Defects_controller->ajax_lookup (controller.php:257)
at Controller->_invoke_web_call (controller.php:168)
at Controller->_invoke_web (controller.php:120)
at Controller->_invoke (gizmo.php:107)
at require_once (index.php:106)

#2

Hi Kenneth,

Thanks for your post! The 401 error code is provided directly from your JIRA instance and would just indicate that either the username/password combination is incorrect, or that your user doesn’t have permission to view the project/issues you’re attempting to access in JIRA. It’s also just possible that the settings you have configured for the integration are incorrect which can cause similar issues. Can you send an e-mail directly to contact@gurock.com with a screenshot of your Administration > Integration page (the full page please including the navigation bar above) as well as a screenshot of your profile > My Settings > Settings tab? This will help us to troubleshoot the issue and we can be in touch via email from there.

We look forward to your email!

Regards,
Marco