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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

VBA can't log in Jira

Hello Jira Community

I am trying to develop a little Excel tool to access to Jira's table and hopefully be able to modify several records at once depending on epic and other criterias.

But for the moment I can't log in to the database.

it always return to VBA "Login Failed" even if I followed the code proposed here :

Is it possible that there is a setting that has to be enabled to authorize external connections? (this is a cloud jira)


Best regards

SebPOur Jira.png

1 answer

Hi @sdeclercq 

The password to authenticate in a Jira Cloud is your JIRA API Token and not your enterprise password. Similarly, your username is your Email Address that you used to login into Jira Cloud.

You can generate one here:

Pass this token as your password & your email address as your username.

Let me know if this helps.



- Aditya

I know this issue was posted a while back, but it is worth a shot.  Aditya, you mentioned that the pwd = JIRA API Token and the user the email address. Does this information needs to be "enconded" as well?

Yes, you'll need to do a base64 encoding for both.

token = Base64(Email Address + ":" + Jira API Token)

Pass the token generated above in the Authorization header.

thank you for replying to my old question.

After some tweaking I succeeded to connect last year and indeed, I had to use the base64 encoding.

Here is my code (I use the "interface" worksheet to store my URL, ID and token.)


Dim JiraService As New MSXML2.XMLHTTP60
Dim JiraAuth As New MSXML2.XMLHTTP60
Dim Réponse As String

Dim Fint As Worksheet
Set Fint = ThisWorkbook.Worksheets("Interface")
Dim XURL As String
Dim XLogin As String
Dim XToken As String
XURL = Fint.Range("URL")
XLogin = Fint.Range("Login")
XToken = Fint.Range("Token")

With JiraAuth

.Open "GET", XURL & "/rest/api/2/search?jql=filter=" & XFiltre & "&startAt=" & StartAt, False
.setRequestHeader "Content-Type", "application/json"
.setRequestHeader "Accept", "application/json"
.setRequestHeader "User-Agent", "machin" 'ajouté par moi pour que ca marche
.setRequestHeader "Authorization", "Basic " & EncodeBase64(XLogin & ":" & XToken)

Réponse = .responseText
If .Status <> "200" Then
      MsgBox ("Erreur " & .Status)
      Exit Sub
End If


and the encodebase 64  est cette fonction:


Public Function EncodeBase64(srcTxt As String) As String
Dim arrData() As Byte
arrData = StrConv(srcTxt, vbFromUnicode)
Dim objXML As MSXML2.DOMDocument60
Dim objNode As MSXML2.IXMLDOMElement

Set objXML = New MSXML2.DOMDocument60
Set objNode = objXML.createElement("b64")
objNode.DataType = "bin.base64"
objNode.nodeTypedValue = arrData

EncodeBase64 = objNode.Text

Set objNode = Nothing
Set objXML = Nothing
End Function

Thank you very much for spending time to send me this information. It works like charm!

At first I thought it didn't, but then I realized data is in JSON. My application is XML ready; I have all kinds of methods and processes to read XML files but not JSON.

So my question would be, is there a way to retrieve data XML format? or... should i look into building a mechanism to read JSON.

Nevertheless I appreciate your help immensely.

I made a mechanism to read Json, so I don't know about the XML.. sorry

No need to be sorry. You have already helped me a lot. It got my code going and my brain is in working mode. There is an XML API request to which I am looking at:

[JRASERVER-67095] JIRA XML API takes a long time to return XML data (search request) - Create and track feature requests for Atlassian products.

So far I am in reading mode... when I get it going I'll post it! I'll make sure I'll mention your code!


To write, you will need this approach: (this one is used to change the status of a task identified by its key)

Texte = "{""transition"":{""id"":""" & Nbstatus & """}}"
.Open "POST", XURL & "/rest/api/2/issue/" & key & "/transitions", False ' & "/transitions?expand=transitions.fields", False
.setRequestHeader "Content-Type", "application/json"
.setRequestHeader "Accept", "application/json"
.setRequestHeader "User-Agent", "machin" 'ajouté par moi
.setRequestHeader "Authorization", "Basic " & EncodeBase64(XLogin & ":" & XToken)
.send Texte


'error management
If Err.Number = -2147467260 Then
GoTo suite
End If
Réponse = .responseText


If .Status <> "204" Then
.Login = True
MsgBox (Réponse & Chr(10) & "Erreur " & .Status)
Exit Sub
End If


Hello - found the above information really useful but struggling to get it working with my code. I have duplicated the above and am still getting an error returned that says the project (in my JQL) does not exist in the projects list. I am assuming that the authorization has failed so I cannot access the data.

The URL I generate works fine and returns valid data when I just enter it directly into the Google top bar. I have also tried creating / using multiple tokens.

I just need to check firstly that nothing has changed with Cloud over the last 6 months that would stop the above working? Also - I am a read only account on the Jira I am accessing - would that have any impact?

The tokens I have created are both showing "Never Accessed" - so I can only assume something is going wrong wit the authorize.


Thanks in advance for anyone who can help.

Like Katherine Tseng likes this

Hi the above code has stopped working for us after Jira extended the token length On Jan 17, 2023.   If the API was generated before with the shorter length, then it is authenticating fine.  However all new API with the longer length is not working.  

I've updated the VBA code to ensure the variable is 512 characters and even tried 1024 characters and still doesn't work.

David Semmens not sure if that is possibly the issue you are facing.

Does anyone have any idea how to fix this?

Suggest an answer

Log in or Sign up to answer