0
我正在尋找一種方法以編程方式設置一個HTTP適配器的憑據? 是某人有一個例子嗎?編程修改工作燈適配器憑證
是否可以修改適配器實現js來覆蓋憑據?
的東西,如:
function getMyAdapters(path) {
var tok = "myuser:mypw";
var hash = Base64Encoder.encode(tok);
var headers="{'User-Agent':'Mozilla'"+"Authentication: Basic }"+hash;
var input = {
method : 'get',
returnedContentType : 'json',
headers: headers,
path : path
};
return WL.Server.invokeHttp(input);
}
但失敗了,因爲它沒有找到Base64Encoder。
任何想法? http://en.wikipedia.org/wiki/Basic_access_authentication
此外,你應該做到以下幾點:
感謝您它幫助我理解我的錯誤;-) – ITDoVe 2013-03-14 15:24:23
很高興我能幫忙。作爲回答請註明這個問題。 – 2013-03-14 16:52:02
最後,我在這裏http://stackoverflow.com/questions/15432608/change-http-url-in-worklight-adapter實施的方法,讓我也提供REST式API的URL。 – ITDoVe 2013-03-17 13:39:11