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 : https://community.atlassian.com/t5/Jira-questions/Access-JIRA-with-VBA-Excel-2010/qaq-p/590003
Is it possible that there is a setting that has to be enabled to authorize external connections? (this is a cloud jira)
Best regards
Seb
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:
https://id.atlassian.com/manage-profile/security/api-tokens
Pass this token as your password & your email address as your username.
Let me know if this helps.
Thanks
- 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.XMLHTTP60Dim JiraAuth As New MSXML2.XMLHTTP60Dim Réponse As String
Dim Fint As WorksheetSet Fint = ThisWorkbook.Worksheets("Interface")Dim XURL As StringDim XLogin As StringDim XToken As StringXURL = 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).sendRéponse = .responseTextIf .Status <> "200" Then MsgBox ("Erreur " & .Status) Exit SubEnd If
------------------------
and the encodebase 64 est cette fonction:
----------------
Public Function EncodeBase64(srcTxt As String) As StringDim arrData() As BytearrData = StrConv(srcTxt, vbFromUnicode)Dim objXML As MSXML2.DOMDocument60Dim objNode As MSXML2.IXMLDOMElementSet objXML = New MSXML2.DOMDocument60Set objNode = objXML.createElement("b64")objNode.DataType = "bin.base64"objNode.nodeTypedValue = arrDataEncodeBase64 = objNode.Text
Set objNode = NothingSet objXML = NothingEnd Function
It looks like you're new here. Sign in or register to get started.