Jörg F. Wittenberger
2018-08-20 12:47:25 UTC
I'm trying to use the http-client to talk to a Jira installation.
Without much success.
Jira is documented to support Basic authentication. However it defaults to
and advertices OAuth. For the case at hand, a script reading some data, it
OAuth looks like wasteful overhead.
The idea is to supply an "Authorization" header right with the request.
Any hints welcome.
So far I have this:
(define (insightc-query!2 uri . more)
(define (basic-auth username pw)
(string-append
"Basic "
(basic-auth-param-subunparser `((username . ,username) (password .
,pw))))
#;`#(Basic ((username . ,username) (password . ,pw)))
#;`#(Basic (,(basic-auth-param-subunparser `((username . ,username)
(password . ,pw)))))
)
(let* ((uri (update-uri uri host: "localhost" port: 7070 path: (append
(uri-path uri) more)))
(username "jwi")
(pw (call-with-input-file ".password" read))
(hdr (headers `((authorization ,(basic-auth username pw)))))
(req (make-request uri: uri headers: hdr)))
(call-with-response req (lambda (x) #f) insightc-response-handler)))
Error: (unparse-headers) could not unparse "Authorization" header (#("Basic
and... ...=" Error: (unparse-headers) could not unparse "Authorization"
header (#("Basic and... ...="
Call history:
intarweb.scm:724: ##sys#print
Without much success.
Jira is documented to support Basic authentication. However it defaults to
and advertices OAuth. For the case at hand, a script reading some data, it
OAuth looks like wasteful overhead.
The idea is to supply an "Authorization" header right with the request.
Any hints welcome.
So far I have this:
(define (insightc-query!2 uri . more)
(define (basic-auth username pw)
(string-append
"Basic "
(basic-auth-param-subunparser `((username . ,username) (password .
,pw))))
#;`#(Basic ((username . ,username) (password . ,pw)))
#;`#(Basic (,(basic-auth-param-subunparser `((username . ,username)
(password . ,pw)))))
)
(let* ((uri (update-uri uri host: "localhost" port: 7070 path: (append
(uri-path uri) more)))
(username "jwi")
(pw (call-with-input-file ".password" read))
(hdr (headers `((authorization ,(basic-auth username pw)))))
(req (make-request uri: uri headers: hdr)))
(call-with-response req (lambda (x) #f) insightc-response-handler)))
Error: (unparse-headers) could not unparse "Authorization" header (#("Basic
and... ...=" Error: (unparse-headers) could not unparse "Authorization"
header (#("Basic and... ...="
Call history:
intarweb.scm:724: ##sys#print