admin管理员组

文章数量:1398827

I have a simple snippet involving Firebase Authentication with two options: email/pass and google. My problem is that users can use the option email/pass smoothly. Regarding Google provider, it can redirect to Google's Oauth2 page, where users select and log in with their Google account. It also redirects back to my original page. However, it seems that the successful callback and error callback have never fired. (Note: with user/pass those callbacks fire as expected)

Here is what I tried

  1. Whitelist domain -> done
  2. Enable Google Provider in Firebase's console -> done

Are there any tips to debug this issue?

window.addEventListener('load', function () {
    document.getElementById('sign-out').onclick = function () {
      firebase.auth().signOut();
    };
  
    // FirebaseUI config.
    var uiConfig = {
      signInSuccessUrl: '/',
      signInOptions: [
        firebase.auth.GoogleAuthProvider.PROVIDER_ID,
        firebase.auth.EmailAuthProvider.PROVIDER_ID
      ],
    };
  
    firebase.auth().onAuthStateChanged(function (user) {
      if (user) {
        // if user is signed in, handle business logic here
      } else {
        // User is signed out.
        // Initialize the FirebaseUI Widget using Firebase.
        var ui = new firebaseui.auth.AuthUI(firebase.auth());
        // Show the Firebase login button.
        ui.start('#firebaseui-auth-container', uiConfig);
      }
    }, function (error) {
      console.error("Authentication state change error:", error);
    });
  });

本文标签: javascriptGoogle provider no response after user loginStack Overflow