question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

firebaseui-web does not redirect after authentication

See original GitHub issue

[REQUIRED] Describe your environment

  • Operating System version: macOS 11.6
  • Browser version: latest Safari
  • Firebase UI version: 6.0.0
  • Firebase SDK version: 9.4.1

[REQUIRED] Describe the problem

Im currently prototyping VueJS based a sign-in flow with Firebase Auth and the web widget library firebaseui-web.

After successful authentication (either password or google provider) the widget loading bar is endlessly repeating and firebaseui-web does not fire its signInSuccessWithAuthResult callback. But the network calls to identitytoolkit.googleapis.com clearly seem to have my user identified and authenticated (see screenshot)

POST calls to identitytoolkit.googleapis.com

Steps to reproduce:

Relevant Code:

The config object looks like this:

const uiConfig = {
  signInSuccessUrl: "#/loggedin",
  signInOptions: [
    EmailAuthProvider.PROVIDER_ID,
    GoogleAuthProvider.PROVIDER_ID,
  ],
  tosUrl: "http://example.com",
  privacyPolicyUrl: "http://example.com",
  signInFlow: "redirect",
  callbacks: {
    signInSuccessWithAuthResult: function (authResult, redirectUrl) {
      console.log("signInSuccessWithAuthResult:", authResult, redirectUrl);
      return true;
    },
    uiShown: function () {
      console.log("uiShown");
    },
  },
};

VUeJS code:

export default {
  name: "Home",
  data: function () {
    return {
      fbUI: {},
    };
  },
  methods: {
    initFBUI: function () {
      const uiReference = firebaseui.auth.AuthUI.getInstance("demoUI");
      console.log("uiReference ", uiReference);
      this.fbUI =
        uiReference !== null
          ? uiReference
          : new firebaseui.auth.AuthUI(this.$fbAuth, "demoUI");
      console.log("this.fbUI", this.fbUI);
    },
    startAuthUI: function () {
      console.log("ui.isPendingRedirect()", this.fbUI.isPendingRedirect());
      this.fbUI.start("#firebaseui-auth-container", uiConfig);
      console.log("this.fbUI started");
    },
  },
  mounted() {
    this.initFBUI();
    this.startAuthUI();
  },
};

Reproduceable demo and full code is under https://github.com/perelin/firebase-auth-providerdata-test.

Here is the CodeSandbox for this rep: https://codesandbox.io/s/github/perelin/firebase-auth-providerdata-test/tree/compat (sometimes it throws a Unexpected token '{' error. Then just reload / rebuild the page.

I would be thankful for any idea what to try next!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
perelincommented, Nov 23, 2021

I refactored the demo to work with compat, still broken, have a look here: https://codesandbox.io/s/github/perelin/firebase-auth-providerdata-test/tree/compat

1reaction
xil222commented, Nov 18, 2021

haven’t dived into this, but since you’re using FirebaseUI v6.0.0 which is dependent on Firebase JS SDK compat library, in line 4 and 5 of your main.js could you try import like import { initializeApp } from "firebase/compat/app"; import { getAuth, onAuthStateChanged } from "firebase/compat/auth";

you can find FirebaseUI recent release notes at

Read more comments on GitHub >

github_iconTop Results From Across the Web

Firebase Auth with firebaseui-web does not redirect after ...
So, I found the issue. It seems that the firebaseui instance returned by firebaseui.auth.AuthUI does not like to be a Vue data property...
Read more >
How to use Firebase UI to control data flow after signing in ...
Use signInSuccessWithAuthResult callback to decide to redirect or stay. The callback will be a function that takes in two parameters, authObject (usually the ......
Read more >
StudyWithMe - firebaseui-web-master - SFU CS Gitlab
When a user has enabled the private browsing mode in Safari, the web storage is disabled. This currently results in an error being...
Read more >
firebaseui - npm
FirebaseUI is an open-source JavaScript library for Web that provides simple, customizable UI bindings on top of Firebase SDKs to eliminate ...
Read more >
Easily add sign-in to your Web app with FirebaseUI - Google
FirebaseUI is a library built on top of the Firebase Authentication SDK ... When not provided, the current URL is used and a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found