2015-02-06 42 views
1

我正在從現有代碼部署內部Gmail上下文小工具。已經部署了小工具在我的谷歌通過闖民宅本文Apps網域:https://developers.google.com/apps-marketplace/preparing如何在Gmail上下文小工具中實施SIGNED授權類型

function makeRequest(){ 
    var params = {}; 
    params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.GET; 
    params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.TEXT; 
    params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.SIGNED; 
    params[gadgets.io.RequestParameters.OAUTH_SERVICE_NAME] = "HMAC"; 
    params[gadgets.io.RequestParameters.REFRESH_INTERVAL] = 3600; 

    var url = "https://applicationid.appspot.com/user/" + sender_name;  
    gadgets.io.makeRequest(url, onResponse, params); 
} 

function onResponse(response) { 
    if (response.rc != 200) { 
     document.getElementById('profile-container').innerHTML = 'Service temporarily unavailable.'; 
     gadgets.window.adjustHeight(); 
    } else { 
     document.getElementById('profile-container').innerHTML = response.text; 
     gadgets.window.adjustHeight(); 
    } 
} 

但這裏response.rc總是返回狀態代碼爲500。而且gadgets.io.makeRequest()功能並不能使到URL(應用程序託管在AppEngine上)的任何請求。這似乎與SIGNED Authorization的問題。如何在Gmail小工具中實現SIGNED Authorization

+0

證書你可以找到如何實現對基準簽名授權:https://developers.google.com/gadgets /文檔/參考/ – gui47 2015-02-11 00:23:37

回答