Error 401 when searching issues using basic authentication

Hi there–
We automated our JIRA issue reports using VBA. We had been doing authentication via cookies, however this process has been deprecated and no longer works.

Therefore, I have been attempting to use a JIRA token for authentication, passing it on in the header of the issue search URL. This URL includes JQL statements to filter the search.

The VBA snippet looks like this:

With jiraService
        .Open "GET", url, False
        .setRequestHeader "Authorization", authenticationStr
        .setRequestHeader "Content-Type", "application/json"
        .setRequestHeader "Accept", "application/json"
        If Not .Status = 200 Then
            MsgBox ("Project Key, username/password, or JQL invalid, or Jira is unreachable")
        End If
        sRestAntwort = .responseText
End With

JiraService is a MSXML2.XMLHTTP60 object

The url looks like:

The authenticationstring is in the format:
“Basic [Base64 conversion of username:token]”

I’ve done a lot of REST work, and have never had problems logging in. But I can’t seem to get away from this 401 error!

Thanks for any info or suggestions you may have!

Hello @eric.miller,

It should be email:apiToken pair; kindly change username to email address. Do try it out and let me know how it goes.


Hi Ian,
Thank you so much for the reply. I should have been more specific that the username is actually my JIRA login Email address.

I guess the last suspect would be my base64 conversion string

To verify if Base64 is the culprit, can you try without Base64 conversion (raw text) via curl if that works for you?


1 Like

Ian, thanks again, will try that now.

Hi Ian,
Thank you for the suggestion. The curl request did successfully go through, resulting in the list of issues. I will go over my Base64 conversion.

Thanks Again!

You’re welcome. It’s the Base64 encoding then :slight_smile: