firebase-js-sdk icon indicating copy to clipboard operation
firebase-js-sdk copied to clipboard

Google sign-in broken on Safari when using Private Mode

Open nickjanssen opened this issue 7 years ago • 14 comments

Environment

  • Operating System version: macOS High Sierra 10.13.4
  • Browser version: Safari 11.1 (Private Mode)
  • Firebase SDK version: 5.3.0
  • Firebase Product: auth (auth, database, storage, etc)

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

nickjanssen avatar Jul 24 '18 01:07 nickjanssen

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.

bojeil-google avatar Jul 24 '18 01:07 bojeil-google

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.)

zwily avatar Feb 19 '19 18:02 zwily

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.

oliviervanbiervliet avatar Feb 21 '19 12:02 oliviervanbiervliet

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

thisismydesign avatar Jul 24 '20 12:07 thisismydesign

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.

veeralpatel avatar Apr 15 '21 16:04 veeralpatel

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 avatar Apr 19 '21 20:04 malcolmdeck

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

veeralpatel avatar Apr 19 '21 20:04 veeralpatel

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.

malcolmdeck avatar Apr 19 '21 20:04 malcolmdeck

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

veeralpatel avatar Apr 20 '21 00:04 veeralpatel

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?

kaytwo avatar Apr 27 '21 13:04 kaytwo

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

veeralpatel avatar May 13 '21 21:05 veeralpatel

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?

DanielRenne avatar Apr 14 '22 04:04 DanielRenne

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

Benny739 avatar Jun 01 '22 20:06 Benny739

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

CetinSert avatar Aug 18 '22 18:08 CetinSert