我試圖在Google Apps腳本中使用StackExchange API的V2.2。Google Apps腳本中的StackExchange API身份驗證
當我嘗試發送POST請求以獲取訪問令牌時,問題出現在顯式OAuth 2.0流程的最後一步。我收到一個404錯誤,但手動發送相同的請求(使用郵遞員擴展)一切正常。
爲了簡化問題,如果我送,沒有有效載荷這個POST請求我收到相同的404
var response = UrlFetchApp.fetch("https://stackexchange.com/oauth/access_token", {
method: 'post',
muteHttpExceptions: true
});
Logger.log(response);
而郵遞員我收到此400:
{
"error": {
"type": "invalid_request",
"message": "client_id not provided"
}
}
我想這將是UrlFetchApp存在問題,但有誰知道如何解決它?謝謝!
由於進行通話,但我得到了同樣的錯誤。我不使用OAuthConfig,因爲它不適用於使用OAuth2的API。我使用[此庫](https://github.com/googlesamples/apps-script-oauth2)的改編,但在此步驟中失敗。 – Gerry 2014-12-03 12:10:20