firebase / firebase-js-sdk

Firebase Javascript SDK
https://firebase.google.com/docs/web/setup
Other
4.83k stars 891 forks source link

Google sign-in broken on Safari when using Private Mode #1040

Open nickjanssen opened 6 years ago

nickjanssen commented 6 years ago

Environment

The problem

signInWithRedirect and signInWithPopUp both don't work in Safari when using Private Mode. Firefox and Chrome work fine.

signInWithPopUp says The popup has been closed by the user before finalizing the operation.

signInWithRedirect redirects but then tries to close its window even though it's not a popup and then results in a blank screen. Can't close the window since it was not opened by JavaScript

Steps to reproduce:

This was noticed by one of our users and we've confirmed the bug. You can see it for yourself here (uses signInWithPopUp): https://editor.laska.io/login

bojeil-google commented 6 years ago

This is a known issue: https://github.com/angular/angularfire2/issues/554 https://github.com/firebase/firebaseui-web/issues/51 https://github.com/firebase/firebaseui-web/issues/270

We rely on web storage to securely pass the result of the operation to the parent domain which is calling these APIs. Private mode browsing breaks this.

zwily commented 5 years ago

Short of actually fixing this, is there a way to detect that this has happened and tell the user not to use Private Browsing? Right now it is a really poor experience (just a white screen after logging in.)

oliviervanbiervliet commented 5 years ago

Short of actually fixing this, is there a way to detect that this has happened and tell the user not to use Private Browsing? Right now it is a really poor experience (just a white screen after logging in.)

For now, we're relying on a timeout in the originating page to detect something went wrong. A better workaround or a fix for the issue would be great.

thisismydesign commented 4 years ago

Having the same issue on Chrome in incognito mode. Reproducible via this CodeSandbox: https://codesandbox.io/s/github/componently-com/firebase-html-auth-starter

veeralpatel commented 3 years ago

https://webkit.org/blog/10218/full-third-party-cookie-blocking-and-more/ Will this change from Apple make this issue more prevalent? Seems like a big deal.

malcolmdeck commented 3 years ago

We have mitigated what we think is the issue in Chrome incognito in recent versions of the SDK, but only for popup. Support for redirect flows is still a work in progress. We imagine that this will cover Apple's changes as well

veeralpatel commented 3 years ago

Does that fix work for https://github.com/google/google-api-javascript-client as well?

malcolmdeck commented 3 years ago

I have no idea how that other library works, but unless it depends on this library in some way (which I don't believe it does) then no. The mentioned fix was for this library only.

veeralpatel commented 3 years ago

My bad, I imagined Firebase's SDK relied on Google's JS client app under the hood.

kaytwo commented 3 years ago

We have mitigated what we think is the issue in Chrome incognito in recent versions of the SDK, but only for popup. Support for redirect flows is still a work in progress. We imagine that this will cover Apple's changes as well

@malcolmdeck can you share a pointer to the commit(s) that fixed this so we can try to use your workaround in other contexts?

veeralpatel commented 3 years ago

^^ +1. It seems like it is still an issue for: https://github.com/google/google-api-javascript-client/issues/589.

DanielRenne commented 2 years ago

I have the same issue on iOS simulator launching a native app that is basically a PWA wrapper app. I have tried both authorizing with Google and Apple and both times after logging in I get the white screen of death. No redirect. Is this issue still being looked into?

Benny739 commented 2 years ago

Same issue in our project with a native app that is basically a PWA wrapper.

CetinSert commented 2 years ago

Hi everyone! We might have found a very simple workaround: https://github.com/pwa-builder/PWABuilder/issues/3286#issuecomment-1219798658 (confirmed from multiple websites).