Dealing with Popups and Redirects

3,583 views
Skip to first unread message

Daniel Steigerwald

unread,
May 24, 2016, 1:32:35 PM5/24/16
to Firebase Google Group
Another feature which just worked in Firebase 2 :-/

So some mobile browsers don't allow popups, for example, Safari in Facebook (only several hundreds millions of users), so old docs suggested solution https://www.firebase.com/docs/web/guide/user-auth.html#section-popups

I tried to mimic old logic

if (error.code === 'auth/popup-blocked') {, 

For some reason, firebaseAuth.signInWithRedirect after failed firebaseAuth.signInWithPopup doesn't work.

TODOS
  • update documentation
  • provide facade function for that
Investigating.

boj...@google.com

unread,
May 31, 2016, 1:55:33 PM5/31/16
to Firebase Google Group
We tried it via console on chrome and safari desktop as well as on an iphone ios version 7.1.2 to make sure it gets blocked and the redirect worked:
var provider = new firebase.auth.FacebookAuthProvider();
auth.signInWithPopup(provider).catch(function(e) {
if (e.code == 'auth/popup-blocked') {
auth.signInWithRedirect(provider);
}
});

Daniel Steigerwald

unread,
Jul 10, 2016, 12:32:20 AM7/10/16
to Firebase Google Group

Bassam

unread,
Jul 10, 2016, 3:01:58 AM7/10/16
to Firebase Google Group
Hey Daniel, we are making some optimization and fixes for signInWithPopup flaky behavior on some mobile browsers. The change may not make it to the coming week's release but should make it in the week after. However, this issue seems to imply some important differences between Facebook in app browser and Safari browser as the api works in one and not the other. One issue could be the window popping mechanism. Is the popup window opening at all?
Is signInWithRedirect working for you?

Daniel Steigerwald

unread,
Jul 10, 2016, 10:41:34 AM7/10/16
to Firebase Google Group
signInWithRedirect works, but not after signInWithPopup. The recommended Firebase 2 workflow doesn't work in Facebook embedded browser. The only thing I can do is detect broken browser manually which is pretty unreliable. Hope you fix it soon.
Also, if user manually close the popup window, it takes 10s for promise to be rejected. 

Bassam

unread,
Jul 20, 2016, 7:53:08 PM7/20/16
to Firebase Google Group
Hey Daniel,
Regarding the 10 second delay, it is to accommodate apps running in slow networks. 
A user could sign in via the popup and the popup would automatically close but there are a couple of backend requests to process the result and  sign in the user after the popup is closed.

Going back to the original topic. I am not familiar with the Facebook embedded browser. I am guessing it is some customized UIWebView or SFSafariViewController.
How does the facebook embedded browser on iOS handle popups? Does it add the new window on top of the previous view?
Just so I understand this clearly,
1. You call signInWithPopup and you get auth/network-request-failed (is the popup actually opening?)
2. You then trigger a signInWithRedirect attempt which is failing (are you getting an error, this only fails after a signInWithPopup attempt)?
Can you provide more information on this.
I will investigate more once I get the details.

Bassam

Daniel Steigerwald

unread,
Jul 23, 2016, 7:33:33 PM7/23/16
to fireba...@googlegroups.com
Embedded browsers are used by hundreds of millions of people, so it's an issue.
I suggest you to check it manually.
Run Firebase auth example, then get your WIFI IP address, then post a
private Facebook status with the link to that IP address, then open
auth example from your mobile Facebook app.
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Firebase Google Group" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/firebase-talk/643d_lwUAMI/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> firebase-tal...@googlegroups.com.
> To post to this group, send email to fireba...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/firebase-talk/38b876de-5267-4fda-afc9-0e1d44322919%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

Daniel Steigerwald

unread,
Jul 29, 2016, 10:48:58 AM7/29/16
to Firebase Google Group
Friendly reminder that Firebase auth still doesn't work in Facebook embedded browser. Firebase 2 worked well.
https://github.com/steida/firebase/issues/15
Reply all
Reply to author
Forward
0 new messages