Unauthorized (401)

[root@node1 //]# curl -u root:root -X POST --data @data.txt -H "Content-Type: application/json" http://localhost:8080/jira/rest/api/2/issue/

 

<html>
<head>
<title>Unauthorized (401)</title>

<!--[if IE]><![endif]-->
<script type="text/javascript">var contextPath = '';</script>
<script> 
window.WRM=window.WRM||{};window.WRM._unparsedData=window.WRM._unparsedData||{};
WRM._unparsedData["com.atlassian.plugins.atlassian-plugins-webresource-plugin:context-path.context-path"]="\"\"";
WRM._unparsedData["com.atlassian.plugins.jira-html5-attach-images:jira-html5-attach-images-resources.resource-uris"]="{\"deployJava.html\":\"/s/en_USh97jhf/6337/4/1.5.11/_/download/resources/com.atlassian.plugins.jira-html5-attach-images:jira-html5-attach-images-resources/deployJava.html\",\"clipboard.jar\":\"/s/en_USh97jhf/6337/4/1.5.11/_/download/resources/com.atlassian.plugins.jira-html5-attach-images:jira-html5-attach-images-resources/clipboard.jar\",\"clipboard-legacy.jar\":\"/s/en_USh97jhf/6337/4/1.5.11/_/download/resources/com.atlassian.plugins.jira-html5-attach-images:jira-html5-attach-images-resources/clipboard-legacy.jar\"}"; 
</script> 
<link type="text/css" rel="stylesheet" href="/s/a87ff679a2f3e71d9181a67b7542122c-CDN/en_USh97jhf/6337/4/3/_/download/superbatch/css/batch.css" media="all"> 
<!--[if lte IE 9]> 
<link type="text/css" rel="stylesheet" href="/s/d41d8cd98f00b204e9800998ecf8427e-CDN/en_USh97jhf/6337/4/3/_/download/superbatch/css/batch.css?conditionalComment=lte+IE+9" media="all"> 
<![endif]--> 
<link type="text/css" rel="stylesheet" href="/s/d41d8cd98f00b204e9800998ecf8427e-CDN/en_USh97jhf/6337/4/8cf774b8fab5fc69dfcb4f354abb2aa8/_/download/contextbatch/css/atl.general/batch.css" media="all"> 
<link type="text/css" rel="stylesheet" href="/s/d41d8cd98f00b204e9800998ecf8427e-CDN/en_USh97jhf/6337/4/8d26f49c7d4aa3dbb86c5bfb0f595b57/_/download/contextbatch/css/jira.general/batch.css" media="all">
<link type="text/css" rel="stylesheet" href="/s/a87ff679a2f3e71d9181a67b7542122c-CDN/en_USh97jhf/6337/4/70e0f36a09c70d4ec7ba475fa61d1407/_/download/contextbatch/css/jira.global/batch.css" media="all">
<script type="text/javascript" src="/s/7b640bac8949aa5154ea9a8109414da4-CDN/en_USh97jhf/6337/4/3/_/download/superbatch/js/batch.js?locale=en-US" ></script>
<script type="text/javascript" src="/s/e7f6f697fc688acc37ab3513fc080ea0-CDN/en_USh97jhf/6337/4/8cf774b8fab5fc69dfcb4f354abb2aa8/_/download/contextbatch/js/atl.general/batch.js?locale=en-US" ></script>
<script type="text/javascript" src="/s/d41d8cd98f00b204e9800998ecf8427e-CDN/en_USh97jhf/6337/4/8d26f49c7d4aa3dbb86c5bfb0f595b57/_/download/contextbatch/js/jira.general/batch.js" ></script>
<script type="text/javascript" src="/s/e0bc9dbb2733d223feed22419efae43f-CDN/en_USh97jhf/6337/4/70e0f36a09c70d4ec7ba475fa61d1407/_/download/contextbatch/js/jira.global/batch.js?locale=en-US" ></script>
<script type="text/javascript" src="/s/618cdcf7eba9a12a6d1169e207b96d15-T/en_USh97jhf/6337/4/1.5/_/download/batch/com.atlassian.administration.atlassian-admin-quicksearch-jira:admin-quicksearch-webresources/com.atlassian.administration.atlassian-admin-quicksearch-jira:admin-quicksearch-webresources.js?locale=en-US" ></script>
<script type="text/javascript" src="/rest/api/1.0/shortcuts/6337/7c50ab94944583add27652c583fe1f6e/shortcuts.js"></script>

<meta name="application-name" content="JIRA" data-name="jira" data-version="6.3.7">
</head>
<body id="jira" class="aui-layout aui-style-default page-type-message" data-version="6.3.7" >
<div class="aui-page-panel"><div class="aui-page-panel-inner">
<section class="aui-page-panel-content">
<header class="aui-page-header"><div class="aui-page-header-inner">
<div class="aui-page-header-main">
<h1>Unauthorized (401)</h1>
</div><!-- .aui-page-header-main -->
</div><!-- .aui-page-header-inner --></header><!-- .aui-page-header -->
<div class="aui-message aui-message-warning warning">
<p>Encountered a <code>"401 - Unauthorized"</code> error while loading this page.</p>
<p><a href="/secure/MyJiraHome.jspa">Go to JIRA home</a></p>
<span class="aui-icon icon-warning"></span></div>
</section><!-- .aui-page-panel-content -->
</div><!-- .aui-page-panel-inner --></div><!-- .aui-page-panel -->
</body>
</html>


[root@node1 //]#

 

Any ideas?

 

The same result if to enter code in one row.

 

curl -D- -u root:root -X POST --data {{ "fields": { "project": { "key": "CI" }, "summary": "REST ye merry gentlemen.","description": "Creating of an issue using project keys and issue type names using the REST API", "issuetype": { "name": "Bug" }}}} -H "Content-Type: application/json" http://localhost:8080/rest/api/2/issue/

 

<html>
<head>
    <title>Unauthorized (401)</title>
                                     

<!--[if IE]><![endif]-->
<script type="text/javascript">var contextPath = '';</script>
<script>                                                     
window.WRM=window.WRM||{};window.WRM._unparsedData=window.WRM._unparsedData||{};
WRM._unparsedData["com.atlassian.plugins.atlassian-plugins-webresource-plugin:context-path.context-path"]="\"\"";
WRM._unparsedData["com.atlassian.plugins.jira-html5-attach-images:jira-html5-attach-images-resources.resource-uris"]="{\"deployJava.html\":\"/s/en_USh97jhf/6337/4/1.5.11/_/download/resources/com.atlassian.plugins.jira-html5-attach-images:jira-html5-attach-images-resources/deployJava.html\",\"clipboard.jar\":\"/s/en_USh97jhf/6337/4/1.5.11/_/download/resources/com.atlassian.plugins.jira-html5-attach-images:jira-html5-attach-images-resources/clipboard.jar\",\"clipboard-legacy.jar\":\"/s/en_USh97jhf/6337/4/1.5.11/_/download/resources/com.atlassian.plugins.jira-html5-attach-images:jira-html5-attach-images-resources/clipboard-legacy.jar\"}";                             
</script>                                                                                                                                                               
<link type="text/css" rel="stylesheet" href="/s/a87ff679a2f3e71d9181a67b7542122c-CDN/en_USh97jhf/6337/4/3/_/download/superbatch/css/batch.css" media="all">             
<!--[if lte IE 9]>                                                                                                                                                      
<link type="text/css" rel="stylesheet" href="/s/d41d8cd98f00b204e9800998ecf8427e-CDN/en_USh97jhf/6337/4/3/_/download/superbatch/css/batch.css?conditionalComment=lte+IE+9" media="all">                                                                                                                                                         
<![endif]-->                                                                                                                                                            
<link type="text/css" rel="stylesheet" href="/s/d41d8cd98f00b204e9800998ecf8427e-CDN/en_USh97jhf/6337/4/8cf774b8fab5fc69dfcb4f354abb2aa8/_/download/contextbatch/css/atl.general/batch.css" media="all">                                                                                                                                        
<link type="text/css" rel="stylesheet" href="/s/d41d8cd98f00b204e9800998ecf8427e-CDN/en_USh97jhf/6337/4/8d26f49c7d4aa3dbb86c5bfb0f595b57/_/download/contextbatch/css/jira.general/batch.css" media="all">
<link type="text/css" rel="stylesheet" href="/s/a87ff679a2f3e71d9181a67b7542122c-CDN/en_USh97jhf/6337/4/70e0f36a09c70d4ec7ba475fa61d1407/_/download/contextbatch/css/jira.global/batch.css" media="all">
<script type="text/javascript" src="/s/7b640bac8949aa5154ea9a8109414da4-CDN/en_USh97jhf/6337/4/3/_/download/superbatch/js/batch.js?locale=en-US" ></script>
<script type="text/javascript" src="/s/e7f6f697fc688acc37ab3513fc080ea0-CDN/en_USh97jhf/6337/4/8cf774b8fab5fc69dfcb4f354abb2aa8/_/download/contextbatch/js/atl.general/batch.js?locale=en-US" ></script>
<script type="text/javascript" src="/s/d41d8cd98f00b204e9800998ecf8427e-CDN/en_USh97jhf/6337/4/8d26f49c7d4aa3dbb86c5bfb0f595b57/_/download/contextbatch/js/jira.general/batch.js" ></script>
<script type="text/javascript" src="/s/e0bc9dbb2733d223feed22419efae43f-CDN/en_USh97jhf/6337/4/70e0f36a09c70d4ec7ba475fa61d1407/_/download/contextbatch/js/jira.global/batch.js?locale=en-US" ></script>
<script type="text/javascript" src="/s/618cdcf7eba9a12a6d1169e207b96d15-T/en_USh97jhf/6337/4/1.5/_/download/batch/com.atlassian.administration.atlassian-admin-quicksearch-jira:admin-quicksearch-webresources/com.atlassian.administration.atlassian-admin-quicksearch-jira:admin-quicksearch-webresources.js?locale=en-US" ></script>
<script type="text/javascript" src="/rest/api/1.0/shortcuts/6337/7c50ab94944583add27652c583fe1f6e/shortcuts.js"></script>

    <meta name="application-name" content="JIRA" data-name="jira" data-version="6.3.7">
</head>
<body id="jira" class="aui-layout aui-style-default page-type-message"  data-version="6.3.7" >
    <div class="aui-page-panel"><div class="aui-page-panel-inner">
            <section class="aui-page-panel-content">
                    <header class="aui-page-header"><div class="aui-page-header-inner">
                            <div class="aui-page-header-main">
                                    <h1>Unauthorized (401)</h1>
                                </div><!-- .aui-page-header-main -->
                        </div><!-- .aui-page-header-inner --></header><!-- .aui-page-header -->
                    <div class="aui-message aui-message-warning warning">
                            <p>Encountered a <code>"401 - Unauthorized"</code> error while loading this page.</p>
                            <p><a href="/secure/MyJiraHome.jspa">Go to JIRA home</a></p>
                        <span class="aui-icon icon-warning"></span></div>
                </section><!-- .aui-page-panel-content -->
        </div><!-- .aui-page-panel-inner --></div><!-- .aui-page-panel -->
</body>
</html>
WTF?
 
credentials for root are correct!!!!

2 answers

0 votes

Is "root" a valid user in JIRA? If so, does it have 'Create' permission in the project? You might want to login in to JIRA using the root user and test.

Ok. Now I understand that was not correct from my side to use root as it is not JIRA user, but only os user. "Admin" is JIRA administrator and os user. But i have error for him to.

 

<html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><title>Oops, you've found a dead link. - JIRA</title><script type="text/javascript">contextPath = "";</script><link type='text/css' rel='stylesheet' href='/static-assets/metal-all.css' media='all'><script src='/static-assets/metal-all.js'></script><!--[if lt IE 9]><link type='text/css' rel='stylesheet' href='/static-assets/metal-all-ie.css' media='all'><script src='/static-assets/metal-all-ie.js'></script><![endif]--><!--[if IE 9]><link type='text/css' rel='stylesheet' href='/static-assets/metal-all-ie9.css' media='all'><![endif]--><meta name="decorator" content="none" /></head><body class=" error-page error404"><script type="text/javascript">document.body.className += " js-enabled";</script><div id="page"><header id="header" role="banner"></header><!-- #header --><section id="content" role="main"><div class="aui-page-panel"><div class="aui-page-panel-inner"><section class="aui-page-panel-content lowerContent"><div id="error-state"><span class="error-type"></span><h1>Oops, you've found a dead link.</h1><ul><li>Go back to the <a href="javascript:window.history.back()">previous page</a></li><li>Go to the <a href="/secure/MyJiraHome.jspa">Home Page</a></li></ul></div></section><!-- .aui-page-panel-content --></div><!-- .aui-page-panel-inner --></div><!-- .aui-page-panel --></section><!-- #content --><footer id="footer" role="contentinfo"><section class="footer-body">

<ul class="atlassian-footer">
    <li>
        Atlassian JIRA <a class="seo-link" href="https://www.atlassian.com/software/jira">Project Management Software</a>
        <span id="footer-build-information">(v6.3.7#6337-<span title='2ed701e65725cadf5ac1c3a73065390f02cf8266' data-commit-id='2ed701e65725cadf5ac1c3a73065390f02cf8266}'>sha1:2ed701e</span>)</span>
    </li>
    <li>
        <a id="about-link" href="/secure/AboutPage.jspa">About JIRA</a>
    </li>
    <li>
                        <a id="footer-report-problem-link" href="/secure/CreateIssue!default.jspa">Report a problem</a>
    </li>
</ul>
    <ul class="atlassian-footer">
        <li class="licensemessagered">
                            Powered by a free Atlassian <a href='JIRA'>http://www.atlassian.com/software/jira'>JIRA evaluation license</a>. Please consider <a href='purchasing'>https://www.atlassian.com/ex/Buy.jspa?product=JIRA&version=6.3.7&build=6337&sid=BL7K-M29E-4E3J-YAU9&ref=prod'>purchasing it</a> today.
                    </li>
    </ul>
<div id="footer-logo"><a href="http://www.atlassian.com/">Atlassian</a></div></section></footer><!-- #footer --></div><!-- #page --></body></html>

and after your notes i have added root user to JIRA with create issue permissions. And now if to do CURL request via command line he has the same error (please, take a look on attached html file or code block) as user admin (JIRA administrator). What can be the cause of the error in this case? Thanks in advance. 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,953 views 19 22
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you