How to make ajax calls to IBM Jazz (RTC) info ... with authentication ?
Some background ... What works
---------------------------------------------
1) https://csnext.ibm.com:8002/jazz/oslc/workitems/11707
If i point my browser as the above url ... it first puts up a login screen , and after I enter my intranet userid and password it successfully displays the requested REST info for that RTC workitem. .. Good !
So, now I'd like to get the same info using an ajax call from a webpage on another server.
First step is to create a proxy on our webserver so gets around ajax x-domain limitation.
2) https://rbdev.ibm.com/virtual/intranet/csnext.ibm.com:8002/jazz/oslc/workitems/11707
And then I have a webpage on this same webserver that makes an ajax call to url 2) above using the "get_url(..)" function listed below.
However, IT FAILS... trying to display the Jazz username/password screen ... it instead just displays "Loading..."
I even tried manually including my username/password as part of the ajax call, hoping this might bypass the Jazz authentication login screen ... but no change.
-----------------------------
What am I missing ? ... How does one successfully make xdomain ajax calls to pull RTC info from a IBM Jazz server that requires authentication ?
I assume this must be a common practice.
Any suggestions / workarounds much appreciated ! Thanks !
----------------------------------------------------------------------------------------------------------
function get_url( urlx ) { var username = "deanw@ca.ibm.com"; var password = "xxxxxxxxx"; var txt = ""; $.ajax({ url: urlx, type: "GET", dataType: "text", async: false, beforeSend: function (xhr){ xhr.setRequestHeader('Authorization', make_base_auth(username, password)); }, success: function(data){ txt = data; }, error: function(msg){ } }); return txt; }