Chrome Android - Inconsistent oAuth Behaviour incognito vs regular

Viewed 206

This questions is related to this other one I posted a few days ago: Instagram oAuth Authentication postMessage issue only with Mobile Browsers

Pretty much the issue I have is that when logging in my app with Instagram Chrome will behave inconsistently (on Android) and cause me some problems.

As I say in that other thread, IG authentication will reply with the required token and data to authenticate the user in my app. It will do this by replying with a script that sends that data back to the original window, using window.opener.postMessage().

When I run my app on Chrome in Incognito mode, window.opener.postMessage will work without any issue since only one tab is opened and the reference to the opener isn't lost.

However, when I run this on the same browser but in regular mode (like probably 90% of people will) the behaviour is different. Chrome will open a tab, close it and open a new one to input auth data. However, window.opener here won't work because the opener reference has been lost (is now null).

How come the same browser, on the same device will have such a different behaviour between two modes? Does anybody know why this happens and how to prevent this from happening?

0 Answers
Related