Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

0 votes



One answer

Permanent link
We've seen similar issues recently. Make sure that "Server B" is a supported environment. The failing code may be related to local libraries.

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 6,122

Question asked: Jun 07 '16, 2:22 a.m.

Question was seen: 2,149 times

Last updated: Jun 07 '16, 3:40 a.m.

Confirmation Cancel Confirm