plugins-legacy icon indicating copy to clipboard operation
plugins-legacy copied to clipboard

Add Asana Integration

Open goesredy opened this issue 8 years ago • 4 comments

Login with google not working yet, try to wrap google oauth in popup, but it's return nothing after success auth.

goesredy avatar Dec 16 '16 02:12 goesredy

Oauth popup issue #78

goesredy avatar Dec 16 '16 02:12 goesredy

Alright so I figured out how to do Asana. I'm sure there is a way to hook into this via the webview.js, and it's only going to work for Asana, since they are nice enough to (1) not minify their code (2) have some oauth code in there for whatever reason (3) have a pretty shameless function onclick for that button. Thank you Asana. Never change.

  1. Set "openDevTools": true

  2. When you arrive at the login screen, use dev tools to select the "Login with Google" Button to find it in the sourcecode

  3. You should see something similar to this: <div tabindex="0" class="buttonView buttonView--primary buttonView--large" id="google_auth_button" onclick="return Dialog.Login.loginWithGoogle(false, 'https://app.asana.com/-/oauth2callback', 'https:\/\/app.asana.com\/')"><span>Use Google Account</span></div>

  4. Change the "false" to "true"

  5. In case you are interested, this argument is whether to initiate oAuth via redirects or popup. True = redirects. This is what we want, as the iframe/popup method can't talk between Franz app <-> Chrome

  6. Click the button.

  7. Your Chrome or Popup or whatever will likely appear. Don't get distracted. Instead, return to your Franz and you should also see a Google login in-frame as well.

  8. Login.

  9. Done.

tayvano avatar May 28 '17 06:05 tayvano

Yeah if you just add:

const getMessages = () => {
    const googleButton = document.getElementById('google_auth_button');
    if (googleButton) {
      googleButton.onclick = function(){ return Dialog.Login.loginWithGoogle(true, 'https://app.asana.com/-/oauth2callback', 'https:\/\/app.asana.com\/') } ;
    }

    ...
    ...
    ...

}

It works.

tayvano avatar May 28 '17 06:05 tayvano

Thanks @tayvano Now it works.

goesredy avatar Jun 01 '17 15:06 goesredy