Hello everybody! I can't make transition via REST because of 401 response code, but I authenticate with right credentials
def authString = "${user}:${password}".getBytes().encodeBase64().toString()
request.addHeader("authorization: Basic ${authString}", "ContentType: application/json")
The response is
Unauthorized (401) (function() { var contextPath = ''; var eventBuffer = []; function printDeprecatedMsg() { if (console && console.warn) { console.warn('DEPRECATED JS - contextPath global variable has been deprecated since 7.4.0. Use `wrm/context-path` module instead.'); } } function sendEvent(analytics, postfix) { analytics.send({ name: 'js.globals.contextPath.' + postfix }); } function sendDeprecatedEvent(postfix) { try { var analytics = require('jira/analytics'); if (eventBuffer.length) { eventBuffer.forEach(function(value) { sendEvent(analytics, value); }); eventBuffer = []; } if (postfix) { sendEvent(analytics, postfix); } } catch(ex) { eventBuffer.push(postfix); setTimeout(sendDeprecatedEvent, 1000); } } Object.defineProperty(window, 'contextPath', { get: function() { printDeprecatedMsg(); sendDeprecatedEvent('get'); return contextPath; }, set: function(value) { printDeprecatedMsg(); sendDeprecatedEvent('set'); contextPath = value; } }); })();
if(window.WRM._dataArrived)window.WRM._dataArrived();Unauthorized (401)Возникла ошибка с кодом "401 - Unauthorized" при загрузке этой страницы.Basic Authentication Failure - Reason : AUTHENTICATED_FAILEDПерейти на домашнюю страницу Jira
Hi, this code request.addHeader("authorization: Basic ${authString}", "ContentType: application/json") works properly when I try to do smth via REST API in another instance of Jira. I always use it and it works without any problems
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Could You please clarify code:
request.addHeader("authorization: Basic ${authString}", "ContentType: application/json")
Looks like You try add two headers. First - "authorization: Basic ${authString}", second - "ContentType: application/json". But I suppose it should like next:
request.addHeader("Header title", "header value")
E.g from my groovy:
connection.addRequestProperty("Authorization", "Basic ${authorization}")
B.R.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.