Mailpile icon indicating copy to clipboard operation
Mailpile copied to clipboard

Detect and notify user when OAuth2 popup is blocked

Open BjarniRunar opened this issue 7 years ago • 3 comments

The OAuth2 flow used by GMail (and probably others, soon enough) relies on a popup window. Some browsers are configured to block pop-ups. We should try and detect when that happens and tell the user something helpful (like: please allow this popup).

BjarniRunar avatar Nov 09 '18 13:11 BjarniRunar

From javascript.info:

Most browsers block popups if they are called outside of user-triggered event handlers like onclick.

For example:

// popup blocked
window.open('https://javascript.info');

// popup allowed
button.onclick = () => {
 window.open('https://javascript.info');
};

The javascript to open the OAuth2 popup is an onclick event, and as such, the popup will most likely not be blocked by most browsers.

zencomplex avatar Nov 19 '19 22:11 zencomplex

Here's a reference for the same type of issue on the facebook/react github

zencomplex avatar Nov 19 '19 22:11 zencomplex

Well yes, it shouldn't be blocked. But we've had reports and seen cases where it was, because of nonstandard settings or security enhancing extensions.

Since the overlap between Mailpile users and users of security-enhancing extensions is relatively large, it makes sense to try and detect this state if possible.

Addendum: Thank you for the link! That looks like a useful resource for whoever decides to research this further.

BjarniRunar avatar Dec 18 '19 14:12 BjarniRunar