I have a Google App Engine Python application that interacts with a JIRA Cloud instance.
To date the application makes urlfetch calls to JIRA using Basic Authentication but as it is now making dozens of separate REST calls both POST and GET I was hoping that using cookie authentication would reduce the latency somewhat.
example Basic-Authentication code that works:
result = urlfetch.fetch(jira_url,
deadline=60,
headers={"Authorization":
"Basic %s" %
base64.b64encode("%s:%s" % (username,
password))
})and cookie alternative:
result = urlfetch.fetch(jira_url,
deadline=60,
headers={"X-Atlassian-Token": "no-check",
"Cookie": "JSESSIONID=529…snip…C4C"
})I retrieved the JSESSIONID successfully using the instructions but the cookie query will only return "401 - Unauthorized" error while loading this page. errors as if the cookie has expired.
{ "errorMessages" :
[ "You do not have the permission to see the specified issue.",
"Login Required" ],
"errors" : {}
}In case it is relevant, I am recalling the cookie from Memcache as most of the interactions are made from a Task Queue and necessarily a separate thread, but the cookie is generated immediately before the recall.