firebase / firebaseui-web

FirebaseUI is an open-source JavaScript library for Web that provides simple, customizable UI bindings on top of Firebase SDKs to eliminate boilerplate code and promote best practices.
https://firebase.google.com/
Apache License 2.0
4.58k stars 1.06k forks source link

Nothing happens when clicking the sign in buttons #763

Open zaibon opened 4 years ago

zaibon commented 4 years ago

I have managed to initialize the widget and the sing-in buttons are showing just fine: 2020-10-11_570x270_scrot

But when I click on them, nothing happens... No popup, no error in the console.

The config I use:

  return {
    callbacks: {
      signInSuccessWithAuthResult: function (authResult, redirectUrl) {
        // User successfully signed in.
        // Return type determines whether we continue the redirect automatically
        // or whether we leave that to developer to handle.
        console.log("success " + authResult);
        return false;
      },
      uiShown: function () {
        // The widget is rendered.
        console.log("widget show");
      },
      signInFailure: function(error) {
        console.log("singin failure "+ error);
      },
    },
    // Will use popup for IDP Providers sign-in flow instead of the default, redirect.
    signInFlow: 'popup',
    // signInSuccessUrl: '/',
    signInOptions: [
      // Leave the lines as is for the providers you want to offer your users.
      firebase.auth.GoogleAuthProvider.PROVIDER_ID,
      firebase.auth.EmailAuthProvider.PROVIDER_ID,
    ],
    autoUpgradeAnonymousUsers: true,
  };
};

And the code to load the widget:

  var that = this;
  firebase.auth().onAuthStateChanged(function (user) {
    console.log("auth change: " + user)
    if (user == null || ui.isPendingRedirect()) {
      // The start method will wait until the DOM is loaded.
      that.signinUI.start('#firebaseui-auth-container', that.getAuthUIConfig());
    }
    that.initAuth(user);
  });

Any idea how I can debug this problem ?

bojeil-google commented 4 years ago

Hmm, I don't see why this would happen based on your snippet. I would imagine an error would be shown in the browser console if there is a problem. More information would be needed to replicate this. It may be something else in the app affecting this.

zaibon commented 4 years ago

I might have a clue. I did try to implement authentication with the SDK directly instead and I discovered that I didn't authorized 127.0.0.1 in the list of authorized domains in the firebase auth settings. Could it be it cause this problem too ?

bojeil-google commented 4 years ago

It could, but that usually will surface an error.

parasharrajat commented 3 years ago

Yeah. We need to specify every domain where we want to use the Firebase Auth. I just met with the same issue. just Dropping a message if someone finds the same issue without any error.