<script>
  function oauthPluginCloseLoginPopup(loggedIn, privateToken) {
    if (window.opener && typeof window.opener.oauthPluginHandleLoginResult == 'function') {
      try {
        window.opener.oauthPluginHandleLoginResult(loggedIn, privateToken);
      } catch (err) {}
      window.close();
    }
    return false;
  }
  oauthPluginCloseLoginPopup(<%= logged_in? %>, '<%= private_token %>');
</script>

<script>
  window.addEventListener("message", function(ev) {
    if (ev.data.message === "requestOauthClientPluginResult") {
      ev.source.postMessage({ message: "oauthClientPluginResult", logged_in: <%= logged_in? %>, private_token: '<%= private_token %>' }, "*");
    }
  });
</script>

Revert "Revert "oauth_client: finish callback""
Revert "Revert "oauth_client: finish callback""

This reverts commit eff12aea9c2050f0acdcda89b10460582485be85.
