未捕获类型错误:t不是函数

时间:2022-04-17 19:43:07

when I click on "login with facebook" it gives this error "Uncaught TypeError: t is not a function". user has logged in but my app not showing home page. When I login without facebook its working correctly

当我点击“登录facebook”时,它会给出这个错误“未捕获的类型错误:t不是一个函数”。用户已经登录,但我的应用没有显示主页。当我在没有facebook的情况下登录时,它会正常工作

login error screenshot http://prntscr.com/ezge48

登录错误截图http://prntscr.com/ezge48

    export function LoginWithFacebook(){
    return (dispatch) => {
        var provider = new firebase.auth.FacebookAuthProvider();
        firebase.auth().signInWithPopup(provider).then(function(result){
            var user = result.user;
            console.log("LoginSuccess");
            dispatch(AllActions.userSignInSuccess(user))
            browserHistory.replace('/home')
        })
                .catch((error) => {
                console.log("login error", error)
                dispatch(AllActions.userSignInFailed(error))
            })
    }
}

below body of HTML

下面的HTML

<script>
  window.fbAsyncInit = function() {
    FB.init({
      appId      : ' app id here ',
      cookie     : true,
      xfbml      : true,
      version    : 'v2.8'
    });
    FB.AppEvents.logPageView();   
  };

  (function(d, s, id){
     var js, fjs = d.getElementsByTagName(s)[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement(s); js.id = id;
     js.src = "//connect.facebook.net/en_US/sdk.js";
     fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));
</script>

1 个解决方案

#1


1  

I've had the same error yesterday, we can see at the line 156:

我昨天犯了同样的错误,我们可以在第156行看到:

    var s=i.getVal(r,'on_login'),
        t=null,
        u=this._iframeOptions.name;

    if(s)
    {
        t=function v(w)
        {
            if(w.error_code)
            {
                j.debug('Plugin Return Error (%s): %s',w.error_code,w.error_message||w.error_description);
                return;
            }
            h.invokeHandler(s,null,[w]);
        };
        this.subscribe('login.status',t);
    }

So if you don't have a valide onlogin attribute on your div class="fb-login-button" this t function is not declared, if I try simply with:

如果你没有在div class="fb-login-button"上有一个valide onlogin属性,这个t函数没有声明,如果我简单地尝试:

<div
    class="fb-login-button"
    data-max-rows="1"
    data-size="large"
    data-button-type="login_with"
    data-show-faces="false"
    data-use-continue-as="true"
    data-scope="email"
    onlogin="console.log('connected')"
></div>

I don't have this problem, all is right.

我没有这个问题,一切正常。

#1


1  

I've had the same error yesterday, we can see at the line 156:

我昨天犯了同样的错误,我们可以在第156行看到:

    var s=i.getVal(r,'on_login'),
        t=null,
        u=this._iframeOptions.name;

    if(s)
    {
        t=function v(w)
        {
            if(w.error_code)
            {
                j.debug('Plugin Return Error (%s): %s',w.error_code,w.error_message||w.error_description);
                return;
            }
            h.invokeHandler(s,null,[w]);
        };
        this.subscribe('login.status',t);
    }

So if you don't have a valide onlogin attribute on your div class="fb-login-button" this t function is not declared, if I try simply with:

如果你没有在div class="fb-login-button"上有一个valide onlogin属性,这个t函数没有声明,如果我简单地尝试:

<div
    class="fb-login-button"
    data-max-rows="1"
    data-size="large"
    data-button-type="login_with"
    data-show-faces="false"
    data-use-continue-as="true"
    data-scope="email"
    onlogin="console.log('connected')"
></div>

I don't have this problem, all is right.

我没有这个问题,一切正常。