polymerfire: fail to signInWithRedirect() from both mobile Chrome and installed PWA, after PWA is installed (i.e. Add to homescreen)?

Description

signInWithRedirect() fail to authenticate and redirect when sign-in from both mobile Chrome and PWA, after the PWA is installed (i.e. Add to homescreen).

I have posted similar issue with Stackoverflow without much luck: How to signInWithRedirect() without redirecting it to the Installed WebApp?

(Note: Everything is working properly if PWA is not installed/Add to homescreen)

Expected outcome

signInWithRedirect() should properly authenticate and redirect to mobile Chrome and installed PWA correspondingly.

Actual outcome

When sign-in from mobile Chrome

Mobile Chrome will redirect to “Sign in - Google Accounts” page, and after proper authentication, will redirect to the mobile Chrome for a brief moment, and back to “Sign in - Google Accounts” page with a never ending loading progress bar on top.

When sign-in from installed PWA (i.e. Add to homescreen)

PWA will redirect to “Sign in - Google Accounts” page, and after authentication, will return back to the PWA as if it’s not authenticated.

Live Demo

https://x-psk3-init.firebaseapp.com/login

Steps to reproduce

This is a code snippet that I am using:-

  tapGoogleSignIn() {
    // Always allow select account, skip auto login
    let provider = new firebase.auth.GoogleAuthProvider();
    // provider.addScope('https://www.googleapis.com/auth/plus.login');
    provider.setCustomParameters({
      prompt: 'select_account',
    });

    this.$.auth.signInWithRedirect(provider)
      .catch((error) => {
        console.log('error:', error);
      });
  }

Browsers Affected

  • Chrome v65 - Android
  • Firefox
  • Safari 9
  • Safari 8
  • Safari 7
  • Edge
  • IE 11
  • IE 10

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 4
  • Comments: 16 (1 by maintainers)

Most upvoted comments

Hi,

I believe this issue is due to w3c/manifest#646. This isn’t a browser-specific issue, but actually a problem with the PWA spec which requires browsers to open out-of-scope links in a separate browsing context (which causes all sorts of issues with redirects).

I’ve heard reports that this is still an issue on Chrome Desktop (which follows the spec). I would expect it to also be an issue on Firefox Android (which follows the spec). It was resolved in Android Chrome 67 by violating the spec (because this is one of our top complaints).

We will be fixing it similarly on Chrome Desktop in https://crbug.com/853593, and I am also proposing a (breaking) fix to the spec text in w3c/manifest#701.