When I do the following, passing my JIRA API token ...
curl --verbose --request GET \
--url 'https://myJira.atlassian.net/....' \
--user 'my_email@domain.com:my_jira_api_token' ...
... the operation succeeds and I see one of the headers was:
Authorization: Basic encodedAuthInfoHere
How would I do the same with Drakma? :basic-authorization
takes a list of username and password. But JIRA says basic auth has been deprecated.
(drakma:http-request url
:method :get
:basic-authorization '(email passwd)
...
Is there a way to perform the same encoding that curl used, and add the header explicitly when calling http-request
? Thanks in advance!
Like for curl, Drakma's password can be whatever you want it to be, so you can insert the jira token as in you did with curl.
Would
(setf drakma:*header-stream* *standard-output*)
(drakma:http-request "https://myJira.atlassian.net/...."
:method :get
:basic-authorization '("my_email@domain.com" "my_jira_api_token"))
spark joy?
I'd expect drakma to create a string my_email@domain.com:my_jira_api_token
, base64-encode it,
and append it to "Authorization: Basic
",
so you'd get a header like this:
Authorization: Basic bXlfZW1haWxAZG9tYWluLmNvbTpteV9qaXJhX2FwaV90b2tlbg==
If your curl example is complete, Drakma should get you as far as curl does.