how to make oauth work when using javascript to access restAPI?
Hi Guys,
I encountered a issue lately. I wrote a javascript as ValueSet to try to get comments from a work item. I want to run this script when I create a new work item. i.e. in context of browser, when I tried to load the page with link: https://<local_server>:9443/ccm/web/projects/...
params.url="https://<local_server>:9443/ccm/oslc/workitems/" + work_item + "/rtc_cm:comments.xml"
params.xpath= "//Collection/Comment";
params.columnXpaths= ["./description"];
params.columnIds= ["wid"];
params.ignoreInvalidCertificates=true;
params.useOAuth=true;
var connector= context.getDataConnector("HttpConnector");
var values= connector.get(params);
But when I run it on Server A, it can work properly. But when I run it on Server B, it can not work at all.
I debugged the code, I noticed it is dead at "context.getDataConnector("HttpConnector"); " , i.e. it can not return back. if I comment out the last two lines, the javascript can work properly back.
So I am wondering it maybe related to oauth. Since I am not admin of Server A, I can not check configuration of the Server A. I am wondering what should I configure besides enable process attachment scripts (which I have already enabled on Server B)?
Any thoughts why I encounter this issue? Thanks for your help!
Best Regards,
Jane Zhou