Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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 Dec 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

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

The API key above has been revoked

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 Jan 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

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 Jan 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

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Software

How to create Jira issus from Excel file?

When to use CSV importer When managing your processes in Jira, there are many occasions where you need to create a lot of tasks. Creating them one by one will cost you a lot of time and effort and i...

4,308 views 22 31
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you