It's all about the answers!

Ask a question

how to make oauth work when using javascript to access restAPI?

jane zhou (106552) | asked Jun 07 '16, 2:22 a.m.
 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"]; 

        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

One answer

permanent link
Donald Nong (14.5k414) | answered Jun 07 '16, 3:40 a.m.
We've seen similar issues recently. Make sure that "Server B" is a supported environment. The failing code may be related to local libraries.

Your answer

Register or to post your answer.