javascript - Google provider no response after user login - Stack Overflow

I have a simple snippet involving Firebase Authentication with two options: emailpass and google.My p

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);
    });
  });

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744697044a4588553.html

相关推荐

  • javascript - Google provider no response after user login - Stack Overflow

    I have a simple snippet involving Firebase Authentication with two options: emailpass and google.My p

    1天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信