chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] http-client help needed with basic authorization


From: Jörg F . Wittenberger
Subject: [Chicken-users] http-client help needed with basic authorization
Date: 20 Aug 2018 14:47:25 +0200

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]