谷歌登录gapi.auth2错误

Dal*_*ngh 5 asp.net google-api oauth-2.0 google-signin

通过以下https://developers.google.com/identity/sign-in/web/reference#googleauthissignedinlistenwzxhzdk44listenerwzxhzdk45在我的网站中实现 Google 登录

我的网站链接 https://golearn.social27.com/academy/login

但我在 IE 11 上遇到错误

gapi.auth2.ExternallyVisibleError:gapi.auth2已使用不同的选项进行初始化。考虑调用gapi.auth2.getAuthInstance()而不是gapi.auth2.init()

这里有什么问题吗?我的代码在这里:

<div class="g-signin2" onclick="checkAuth();" style="display:none">

function checkAuth() {
        /// <summary>
        /// Checks the authentication, click event of the google auth.
        /// </summary>
        /// <returns></returns>
        gapi.auth2.init({ client_id: clientId });
        var googleAuth = gapi.auth2.getAuthInstance();
        googleAuth.currentUser.listen(onSignInCallback);
        googleAuth.signIn(
            {
                'scope': 'profile email'
            }
        );
    }
    /**
     * Handler for the signin callback triggered after the user selects an account.
     */
    function onSignInCallback(resp) {
        var googleAuth = gapi.auth2.getAuthInstance();
        var user = googleAuth.currentUser.get();

        MethodToDO(user.getBasicProfile().getGivenName(), user.getBasicProfile().getFamilyName(), user.getBasicProfile().getEmail(), user.getBasicProfile().getEmail());//user.getBasicProfile().getId()
    }
Run Code Online (Sandbox Code Playgroud)