On Thu, 2018-09-13 at 16:42 +0200, Daniel Gruno wrote:
> On 09/13/2018 04:38 PM, Robert Munteanu wrote:
> > Hi,
> > 
> > I am trying to simplify my job of keeping the list of sources up-
> > to-
> > date for the Kibble demo instance. Basically we add git
> > repositories
> > periodically and I want to add them to Kibble as well.
> > 
> > I was thinking of using the Kibble API to retrieve the list of
> > sources
> > and checking which of our repositories are not there, so I can
> > easily
> > paste them in Kibble.
> 
> It's a bit convoluted at the moment, apologies.
> First, you have to obtain a session cookie by logging in;
> https://demo.kibble.apache.org/apidoc.html#put-api-session
> when you have that cookie, pass it to the API end point you wish to
> use, 
> and it should work just fine.
> 
> I'll be working later next week on API tokens for use here, it's one
> of 
> the things that are still missing.

I'm trying to set this up but not managing - perhaps there is a flaw in
my code? I'm using something like

$ curl --cookie-jar .cookies -v -X PUT -H "Content-Type: application/json" 
https://demo.kibble.apache.org/api/session -d "{ \"email\": \"${1}\", 
\"password\": \"${2}\" }" 
$ curl -v --cookie .cookies https://demo.kibble.apache.org/api/session
$ rm .cookies

While the first call succeeds, for the second one I get 

< HTTP/1.1 403 Authentication failed
< Date: Mon, 17 Sep 2018 16:24:42 GMT
< Server: gunicorn/19.6.0
< Content-Type: application/json
< Transfer-Encoding: chunked
< 
{
    "code": 403,
    "reason": "You must be logged in to use this API endpoint! %s"
}

I can see the cookie being sent and then returned. But If I got my
timezone calculations correctly, the cookie immediately expires

Just now I got

< Set-Cookie: kibble_session=f7dc532d-dcb4-4fa2-ad80-3e8c83a4b0e2; expires=Tue, 
17 Sep 2019 16:27:14 GMT

which looks to be 'now'.

Any hints on how to solve this?

Thanks,

Robert

Reply via email to