Authentication with third party website

I’m building an app that provides a board view which requires authentication with a third party website. The third party website uses Google to authenticate users, by providing a “Sign in with Google” button that launches a dialog allowing the user to sign in with their Google credentials. Will this solution be reliable when used within a board view iframe or will some browsers block session cookies in the iframe? Any suggestions on the best approach?

@Roobrick

From my experience, your best option is to open the authorisation process in a new window as some requests will be blocked by CORS as your view runs in an iframe.

const myWindow = window.open(API_URL+'/authorisation', "_blank", "toolbar=yes,scrollbars=yes,resizable=yes,top=500,left=500,width=800,height=800");
    var self = this;
    var timer = setInterval(function() { 
      if(myWindow.closed) {
          clearInterval(timer);
          self.checkValidAccount(self.state.sessionToken);
      }
    }, 500);

Something like this has worked for me

2 Likes

Hey @Roobrick,

I think @mitchell.hudson suggestion might be best here (as usual, he is awesome) - my suspicion requests will be blocked by CORS as he mentioned. Could you try the solution he posted above?

Google also provides some information on adding Google sign-in to your webapp here.

Let me know if we can help with anything else!

-Danny

1 Like

Thanks @mitchell.hudson and @dsilva. I’m using a Google API at the moment to launch a popup window and it is working, although I don’t think it will work in an iOS webview should that be supported in the future.

1 Like

@Roobrick I’m glad @mitchell.hudson and @dsilva were able to provide helpful suggestions, they’re awesome :slight_smile:

-Alex