Jira API - basic authorization with API token results in ... do not have permission since 20191218

Michael Germeys December 17, 2019

I have several vbscripts that connect to JIRA cloud.  Everything worked fine until today.  Now I am always getting the error:

{"errorMessages":["Issue does not exist or you do not have permission to see it."],"errors":{}}
,"errors":{}}

I use a basic authorization with API token.

I can login with my account and see all issues without any problem but not when I connect through the API. 

I have created a second API token and used that one too, but I do get the same error.

1 answer

1 accepted

0 votes
Answer accepted
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 19, 2019

Hi Michael,

Atlassian Cloud products did deprecate the use of passwords/cookies for basic auth REST API requests.  More details in Deprecation notice - Basic authentication with passwords and cookie-based authentication.  However this happened six months ago.  So I'm not sure why you would suddenly see this problem this week.

The error message you are seeing though appears to be consistent with a REST API call that is not actually authenticated as expected.   I would be interested to see if we can learn more about exactly how you are making the authentication portion of this REST call.  If we refer back to the Basic auth for REST APIs, you can still use an API token, but there is an expectation many times that you would have to first base64 a string consisting of

youremail@example.com:API_TOKEN

and then pass that encoded string in an authorization header instead of trying to simply pass username and API token in a prompt.

Try that out and see if this helps.  If not, please share with us some more details about how you're trying to make this API call and perhaps we can offer some further insights.

Cheers,

Andy

Michael Germeys January 5, 2020

Hello Andy,

thanks for your response.  I am using a API token and it is base-64 encoded. We use it for more than 1 year now without issues.

Can it be related to changing authorisations?

I have a vb function:

Function getJiraInfo(issueID)
    Dim restReq, url, uname, passw
    Set restReq = CreateObject("Microsoft.XMLHTTP")
    url = "https://macadam.atlassian.net/rest/api/2/issue/" & issueID
    restReq.open "GET", url, false    restReq.SetRequestHeader "Authorization""Basic bWljaGFlbC5nZXJtZXlzQG1hY2FkYW0uZXU6OEJXSTF2NGhac1VRczkxQ0Y4R0hENUI5"    restReq.send    
    getJiraInfo = restReq.responseText
End Function

And I tried it in Excel:

Private JiraService As New MSXML2.XMLHTTP60
Private JiraServiceX As New MSXML2.ServerXMLHTTP60
Private JiraAuth As New MSXML2.XMLHTTP60

Sub doJira()

Dim issuesJSON

With JiraService
.Open "Get", "https://macadam.atlassian.net/rest/api/2/issue/QA-1622"
.setRequestHeader "Authorization", "Basic base64Encoded" 'NEW PASSWORD WITH TOKEN

.setRequestHeader "Content-Type", "application/json"
.setRequestHeader "Accept", "application/json"
.send
issuesJSON = .responseText
Debug.Print issuesJSON
End With

End Sub

Kind regards,

Michael

Michael Germeys January 5, 2020

The API key above has been revoked

Michael Germeys January 7, 2020

I have issued new API keys for my account and our administrator account.  Using the administrator (full access) API key, I do get the same error message.

Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 13, 2020

Hi Michael,

Thanks for posting all the details here.  I do not see any errors clearly from what you have posted.  I went to check to see if there might be problems with your account in some way, but found nothing there either. 

Did you happen to come across a solution here?  Please let us know either way.

Thanks

Andy

Michael Germeys January 13, 2020

Hello Andy,

the problem is solved. I use 2 accounts to access JIRA: 1 via Chrome and another one via IE (only for HelpDesk). Now when I access the api via basic authentication using my first account, suddenly a cookie was sent along with data from my second account causing the failure.

I cleared my cookies from the internet explorer and now it's working again.

Thanks for your help,

Michael

Like Andy Heinzer likes this
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 14, 2020

Thanks for posting back with your solution here.  If you like you can accept my answer, OR if you prefer, post your solution as it's own answer and accept that.  This will help to mark the question has having a solution, in turn it can make it easier for other users that might have the same problem to figure out why.

Cheers,

Andy

patriciaalejandra_gutierrez January 24, 2022

Buen día 

Me pueden comentar cual fue la solución?

Suggest an answer

Log in or Sign up to answer