token.js

(function() {

receiveToken parses the OAuth token from the URL params

  var token = remoteStorage.receiveToken();

We send the token back to our main page

  window.opener.postMessage(token, location.protocol+'//'+location.host);

and close the window.

  window.close();
})();