Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trello API - Unauthorized permission request

I am trying to write a little script to update cards with the amount of time the card has been on the list it is currently on, so we can optimize our throughput. I wrote a little script on jsfiddle that almost works, but I'm getting a "unauthorized card permission requested" when trying to use:

Trello.post("cards/" + card.id + "/actions/comments", {text: "This card has been in this list for " + ago + " days."})

or...

Trello.put("cards/" + card.id + "/name", "(" + ago + ") " + card.name);

Here is the fiddle, if that helps: http://jsfiddle.net/A3Xgk/2/

Any ideas? Thanks!

like image 663
Stirman Avatar asked Dec 11 '22 19:12

Stirman


2 Answers

Try request your app token from https://trello.com/1/connect?key=yourkey&name=your_board_name&expiration=never&response_type=token&scope=read,write

reference: https://github.com/zmilojko/git-trello

like image 174
lmnbeyond Avatar answered Dec 28 '22 05:12

lmnbeyond


The "unauthorized card permission" that is being requested is the write permission

In your jsfiddle example, when the "Connect to Trello" window pops up, you'll notice it says

The app will be able to:

  • Read all of your boards and organizations

It won't be able to:

  • Create and update cards, lists and boards
  • Make comments for you
  • Read your email address
  • See your Trello password

You need to request a token that has write permissions, which you can do by changing the scope parameter to Trello.authorize:

$("#connectLink").click(function() {
    Trello.authorize({
        type: "popup",
        scope: { read: true, write: true },
        success: onAuthorize
    });
});

(The default value for scope in the source for client.js is { read: true, write: false })

like image 38
Daniel LeCheminant Avatar answered Dec 28 '22 05:12

Daniel LeCheminant