firebase / firebase/firebase-js-sdk
[COOP/COEP] Firebase auth hangs at the auth route, then returns with no success or error message
- Dominant language
- TypeScript
- Stars
- 5.1k
- Forks
- 1k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 37
Description
### [REQUIRED] Describe your environment
* Operating System version: Mac
* Browser version: 100.0.4896.127
* Firebase SDK version: 9.7.0
* Firebase Product: auth
Note: this auth flow was working previously (last known working date ~mid March), but has since broken even though no code changes occurred on my end.
### [REQUIRED] Describe the problem
#### Steps to reproduce:
1. Navigate to https://hoten.cc/gridia/play/?debugFirebase
2. Click Join Server
3. Choose sign in with google
4. `https://gridia-434b8.firebaseapp.com/__/auth/handler?state=...` opens and loads for ~10 seconds, then returns to the page
5. Auth page closes, but webapp was not given any response (success or otherwise). Neither `signInSuccessWithAuthResult` or `signInFailure` was called
However, the "Sign in with email" flow does work.
#### Relevant Code:
Relevant code from repro given above (there are also source maps, the relevant file is `account-scene.tsx`:
```javascript
const unsubscribe = this.firebaseAuth.onAuthStateChanged(async (user) => {
unsubscribe();
if (user) {
const firebaseToken = await user.getIdToken(true);
await this.login(firebaseToken);
return;
}
Helper.createChildOf(document.head, 'link', '', {
rel: 'stylesheet',
href: 'https://www.gstatic.com/firebasejs/ui/5.0.0/firebase-ui-auth.css',
});
const ui = new firebaseui.auth.AuthUI(this.firebaseAuth);
const signInOptions = [
// TODO: why isn't this working any more?
// GoogleAuthProvider.PROVIDER_ID,
{
provider: EmailAuthProvider.PROVIDER_ID,
requireDisplayName: false,
},
];
if (new URL(location.href).searchParams.has('debugFirebase')) {
// @ts-expect-error
signInOptions.unshift(GoogleAuthProvider.PROVIDER_ID);
}
ui.start('.firebaseui-auth-container', {
signInOptions,
signInFlow: 'popup',
callbacks: {
signInSuccessWithAuthResult: (authResult) => {
this.onFirebaseAuthSuccess(authResult);
// Return control to the game (no redirect).
return false;
},
signInFailure: (authResult) => {
console.error(authResult);
},
},
});
});
```
Contributor guide
Assessment
This issue has not been assessed yet.