## 2018-01-16 Playing with Trello

```javascript

import focalStorage from 'src/external/focalStorage.js';

(async () => {
  
  var trelloKey = "TrelloDeveloperKey"
  var key = await focalStorage.getItem(trelloKey)
  
  if (!key) {
    key = await  lively.prompt("Insert your <a href='https://trello.com/app-key'>Trello Developer Key</a>", "")
    focalStorage.setItem(trelloKey, key)
  }

  lively.loadJavaScriptThroughDOM("Trello", `https://api.trello.com/1/client.js?key=${key}`)

  localStorage.removeItem('trello_token');
  const opts = {
    type: 'popup',
    name: 'Trello Sandbox',
    interactive: true,
    scope: { read: true, write: true, account: false },
    expiration: '1day',
    persist: true,
    success: () => { lively.notify("success")},
    error: () => { lively.notify("error")},
  };
  Trello.authorize(opts);


  function asyncOutput(output) {
    console.log(JSON.stringify(output));
    $morph("output").innerHTML = JSON.stringify(output, null, 2);
  }

  // Get all of the information about the list from a public board

var success = function(successMsg) {
  asyncOutput(successMsg);
};

var error = function(errorMsg) {
  asyncOutput(errorMsg);
};

Trello.get('/boards/555c8e81e8d5aff570505f5b/lists', success, error);
  
  
})()
```