Fusion テーブルを更新するスプレッドシートで実行しているコードに問題があります。次のコードを実行します (プライバシーのためにフュージョン テーブル ID は省略されています)。
function updateFusion() {
var tableIDFusion = '##############################'
var email = UserProperties.getProperty('email');
var password = UserProperties.getProperty('password');
if (email === null || password === null) {
email = Browser.inputBox('Enter email');
password = Browser.inputBox('Enter password');
UserProperties.setProperty('email',email); 'email'
UserProperties.setProperty('password', password);
}
var authToken = getGAauthenticationToken(email,password);
deleteData(authToken, tableIDFusion);
updateData(authToken, tableIDFusion);
SpreadsheetApp.getActiveSpreadsheet().toast(Logger.getLog(), "Fusion Tables Update", 10)
}
//Google Authentication API this is taken directly from the google fusion api website
function getGAauthenticationToken(email, password) {
password = encodeURIComponent(password);
var response = UrlFetchApp.fetch("https://www.google.com/accounts/ClientLogin", {
method: "post",
payload: "accountType=GOOGLE&Email=" + email + "&Passwd=" + password + "&service=fusiontables&Source=testing"});
var responseStr = response.getContentText();
responseStr = responseStr.slice(responseStr.search("Auth=") + 5, responseStr.length);
responseStr = responseStr.replace(/\n/g, "");
return responseStr;
}
引き続きエラーが発生します: Request failed for https://www.google.com/accounts/ClientLogin returned code 403. Server response: Error=BadAuthentication (line 97)
私はコーディングを理解していますが、サーバーやプログラムが相互に作用する方法やフォーミュラ チームの Web サイトのコードが渡されたことについてはあまり理解していません。
どんな助けでも大歓迎です!