Skip to content

Commit 4949a7b

Browse files
committed
Repro race condition with signInWithRedirect in demo app
1 parent e2ba89f commit 4949a7b

File tree

3 files changed

+5063
-1
lines changed

3 files changed

+5063
-1
lines changed

packages/auth/demo/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"dependencies": {
2020
"@firebase/app": "0.7.24",
21-
"@firebase/auth": "0.20.1",
21+
"@firebase/auth": "file:..",
2222
"@firebase/logger": "0.3.2",
2323
"@firebase/util": "1.6.0",
2424
"tslib": "^2.1.0"

packages/auth/demo/src/index.js

+21
Original file line numberDiff line numberDiff line change
@@ -1812,6 +1812,27 @@ function initApp() {
18121812
},
18131813
onAuthError);
18141814

1815+
// Try sign in with redirect once upon page load, not on subsequent loads.
1816+
// This will demonstrate the behavior when signInWithRedirect is called before
1817+
// auth is fully initialized. This will fail on firebase/auth versions 0.21.0 and lower
1818+
// due to https://github.com/firebase/firebase-js-sdk/issues/6827
1819+
/*
1820+
if (sessionStorage.getItem('redirect-race-test') !== 'done') {
1821+
console.log('Starting redirect sign in upon page load.');
1822+
try {
1823+
sessionStorage.setItem('redirect-race-test', 'done');
1824+
signInWithRedirect(
1825+
auth,
1826+
new GoogleAuthProvider(),
1827+
browserPopupRedirectResolver
1828+
).catch(onAuthError);
1829+
} catch (error) {
1830+
console.log('Error while calling signInWithRedirect');
1831+
console.error(error);
1832+
}
1833+
}
1834+
*/
1835+
18151836
// Bootstrap tooltips.
18161837
$('[data-toggle="tooltip"]').tooltip();
18171838

0 commit comments

Comments
 (0)