2
votes

I am trying to make a trelloApp library for Google Apps Script which works fine when I run it as the owner of the script. Now when adding it as a library to a script of another user I always get an error message about using the wrong token.

This would be the library MXATH_jOrClwhJxK58e3b7OPNgVSik-PP

To test would be

var API_KEY = "Your Api Key";  //https://trello.com/1/appKey/generate


function test() {
   var app = trelloApp.openById(API_KEY)

   var organizations = app.getMyOrganizations();

   for (var i = 0; i < organizations.length; i++) {
     var organization = organizations[i];
     Logger.log(organization.getId()+ ' ' + organization.getDisplayName())
   }
}

This would be the library in itselve (I removed the script properties with the keys)

And the error I am getting is: Response truncated by the server: expired token (use the option muteHttpExceptions to view the complete repsonse completa) (line 50, archieve "")

The oauth1 depreceation for Google apps Script does not seem to matter as it works fine with my own user.

1
Did you use the muteHttpExceptions to fetch the complete response of what the error is?pointNclick
Yep! The url gives unexpexted token. UrlFetchApp.fetch([api.trello.com/1/members/me/…, {method=GET, muteHttpExceptions=true, oAuthUseToken=always}]) [0.672 seconds] [15-08-01 10:36:05:327 BRT] HTTPResponse.getContentText() [0.004 seconds] [15-08-01 10:36:05:330 BRT] Execution failed: SyntaxError: Unexpected token: i (line 20, file "APP", project "trelloApp") [0.79 seconds total runtimeJacobvdb
which one is Line 20?pointNclick
Using the oauth1 library the use UrlFetchApp.fetch is wrong and should be should service.fetch. Still though I was unable to put the entire Oauth flow in a library. There seems to be a mismatch between the authorizer and the script executer...Jacobvdb
I'm having a go at a GAS Trello library myself, is the link to the latest copy of your library? Thanks, AndrewAndrew Roberts

1 Answers

0
votes

Nice looking library - just what I was looking for after much head-scratching about the Trello API!

I took a copy and found that if I deployed the authorization web app as "user running app" my copy of the library seemed to work fine from another Google Account.