How can I activate Basic Authentication on my Jira instance?
I am getting an error response: Basic auth with password is not allowed on this instance
Hi Enido,
Basic Auth still works on Confluence Cloud, but you have to use an Atlassian API Token as password and your Atlassian Id email as username.
You will get the error "Basic auth with password is not allowed on this instance" also if you provide a wrong username/password. This should be fixed by Atlassian to avoid confusion.
So try again with a valid Atlassian Id + API token.
Example:
GET https://<your-instance-name>.atlassian.net/wiki/rest/api/content/123123
Content-Type: application/json
Accept: application/json
Authorization: Basic yourBase64EncodedUsernameColonPassword
Good luck!
On my side If I do a test with Insomnia :
It's work fine
But If I do the same test in VBA with MSXML2.XMLHTTP60 and I setRequestHeader "Authorization", "Basic " & sEncbase64Auth
I alway have an empty response while I use the same credential
Do you have any idea from the reason of this specific response on VBA ?
Below my VBA code:
Private Function UserPassBase64(text As String) As String
Dim objXML As MSXML2.DOMDocument60
Dim objNode As MSXML2.IXMLDOMElement
Dim arrData() As Byte
arrData = StrConv(text, vbFromUnicode)
Set objXML = New MSXML2.DOMDocument60
Set objNode = objXML.createElement("b64")
objNode.DataType = "bin.base64"
objNode.nodeTypedValue = arrData
UserPassBase64 = objNode.text
End Function
Sub test()
Dim JiraService As New MSXML2.XMLHTTP60
Dim sUsername As Variant
Dim sPassword As Variant
Dim sRestAntwort As Variant
Dim sStatus As Variant
Dim sEncbase64Auth As Variant
sUsername = "" 'Atlassian e-mail of your account
sPassword = "" 'Token generated by https://id.atlassian.com/manage/api-tokens
sEncbase64Auth = UserPassBase64(sUsername & ":" & sPassword)
With JiraService
.Open "GET", "https://xxxxxxx.atlassian.net/rest/api/3/project", False
.setRequestHeader "Content-Type", "application/json;charset=UTF-8"
.setRequestHeader "Accept", "application/json"
.setRequestHeader "Authorization", "Basic " & sEncbase64Auth
.send
sRestAntwort = .responseText
sStatus = .Status & " | " & .statusText
Debug.Print "--------" & Now & "--------"
Debug.Print sRestAntwort
Debug.Print sStatus
Debug.Print "--------" & Now & "--------"
End With
End Sub
Result:
--------23/01/2020 16:52:02--------
[]
200 |
--------23/01/2020 16:52:02--------
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Awesome, it works.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Stephane.arenas - interesting, because from what I understand in your VB code (wow, long time no see VB! ;)) - you get an empty json array as response. Are you sure you have the rights to browse projects? can you try another endpoint? can you reproduce the request with curl or something similar?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Lukas Gotter _ Meetical , as I say on my first post with the same credential it work fine with Insomnia (Postman like). If I try curl -D- -u xxxx:yyyyyyy -X POST -H "Content-Type: application/json" https://zzzzzz.atlassian.net/rest/api/3/project . it works fine also.
If I don't use UserPassBase64 and I tried to set directly .setRequestHeader "Authorization", "Basic " & sUsername & ":" & sPassword, I have got 403 error (Basic auth with password is not allowed on this instance)
But if I change keep UserPassBase64 and I add on or tow mors characters to my e-mail adress or my token I alway have an empty json and http response to 200 even if my credential is not good.
So I think that we have an issu with credential but I don't uderstand what is the mistake
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Stephane.arenas well then it seems your base64 function is not working correctly. Try with a test user and set the user:password as base64 encoded string you get from https://www.base64encode.org/ - if that works, it's your function and I assume you will find a good one online for VB. - good luck!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
https://www.base64encode.org/ look like give the same result as my base64 function, but in my base64 function I have a LF car(10) after 72 charater.
If I tried to used directly the https://www.base64encode.org/ result (without LF) I had a 403 http Error "Basic auth with password is not allowed on this instance"
But we were on the good way to focus on base64 function
When I look timeline tab on Insomnia I notice that I don't have the same encryption for mycredential, and if I use "Insomnia credential encryption" in my vba code it's work fine.
So I worked to undestand why I had a bad encryption with my base64 function,
And I fine the solution....... I'm stupid and I don't know how to realize a simple copy paste of my API key.
After some check, I discovered that on my VBA version I had 4 extract characters in the middle of my API Token. (Perhaps I tried to start to write on ohters windows withour click on it)
I apologize for the time you spent to help a so stupid guy as me.
;)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No worries, good to hear I'm glad if I could help. Many greetings, Lukas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Stephane.arenasThanks!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello, basic authentication has been deprecated recently:
"update your app or integration to use API tokens, OAuth, or Atlassian Connect"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, thank you for your quick response.
I created an api token, concatenated it with the email and encoded it to base64 and added as a header field. Can I still use this way to access Confluence?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm not 100% sure, but as far as I understand, token is created for the account to access any cloud products it has access to, so yes
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.