Merge pull request #3822 from fidelcoria/fix-login-race

fix(auth): race condition between loginPopup and authFlowHelpers
This commit is contained in:
Fredrik Adelöw
2020-12-28 15:55:22 +01:00
committed by GitHub
2 changed files with 8 additions and 1 deletions
@@ -56,7 +56,9 @@ export const postMessageResponse = (
var originInfo = {'type': 'config_info', 'targetOrigin': origin};
(window.opener || window.parent).postMessage(originInfo, '*');
(window.opener || window.parent).postMessage(JSON.parse(authResponse), origin);
window.close();
setTimeout(() => {
window.close();
}, 100); // same as the interval of the core-api lib/loginPopup.ts (to address race conditions)
`;
const hash = crypto.createHash('sha256').update(script).digest('base64');