Originally published at: http://www.sitepoint.com/build-trello-chrome-extension-exporting-lists/
- How To Build a Trello Chrome Extension – API Authentication
- How To Build a Trello Chrome Extension – Exporting Lists
When we authenticate with Trello on the settings screen, the Trello token is saved in local storage. However, the settings page is its own page and, effectively, its own environment – ergo, neither the extension’s background page nor the extension’s content scripts have access to it. This is where we need to use message passing.
chrome.extension.sendMessage API is used to send messages to and from background pages. In our case, we’ll be using it to send the token from the settings page to our background page. Since our settings adventure is done as soon as this is completed, we might as well automatically close the tab, to improve user friendliness.