Você pode acabar tendo problemas se seu projeto:
Idéia:
function storeTokens(refresh, access) { // Use UserProperties to safely store tokens var userProperties = PropertiesService.getUserProperties(); var tokens = {refreshToken: refresh, accessToken: access}; userProperties.setProperties(tokens); }
function callAPI() { //Gets token from UserProperties, //exchanging the refresh token by a fresh access token, if expired var accessToken = getAccessToken(); var options = {method : "[ GET | POST | PUT | DELETE ]"} //Add access token to request header options.headers = {Authorization: "Bearer " + accessToken}; var apiURL = "https://[APP_ID].appspot.com/_ah/api/[API_NAME]/[VERSION]/[PATH]"; var responseText = UrlFetchApp.fetch(apiURL, options).getContentText(); return responseText; }
Apresenta quase todos problemas citados anteriormente:
function recordATransaction() { var ledgerId = "agtzfmJrcGVyLWhyZHIOCxIGTGVkZ2VyGNKJAgw"; var ledger = BkperApp.openLedgerById(ledgerId); ledger.record("#gas 63.23"); }
"A platform-less product will always be replaced by an equivalent platform-ized product"