code: function handleLogin(onCloudLoginSuccess) {
    const link = authLink();
    const authWindow = window.open(link, '_blank', 'width=1024,height=716');
    const handleToken = e => {
      // TODO: add security step to validate which domain the message is coming from
      authWindow.close();
      window.removeEventListener('message', handleToken);
      dropbox.setAccessToken(e.data.token);
      if (window.localStorage) {
        window.localStorage.setItem('dropbox', JSON.stringify({
          // dropbox token doesn't expire unless revoked by the user
          token: e.data.token,
          timetamp: new Date()
        }));
      }
      onCloudLoginSuccess();
    };
    window.addEventListener('message', handleToken);
  }
docs: This method will handle the oauth flow by performing the following steps:
  - Opening a new window
  - Subscribe to message channel
  - Receive the token when ready
  - Close the opened tab