Login to my site use google api [onsignincallback not found error]

I use google api on my website to get user information from google plus api.I click the login button to enter and click (permission to view profile profile information). Everything is OK, but one error is displayed in the browser console.

"Callback function named" signinCallback "not found" cb = gapi.loaded_0: 492

The return callback function does not work. How to solve this problem?

My google code plus api:

(function() {
        var po = document.createElement('script');
        po.type = 'text/javascript';
        po.async = true;
        po.src = 'https://apis.google.com/js/client:plusone.js';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(po, s);
    })();

function signinCallback(authResult) {
        alert("login success");
        if (authResult['status']['signed_in']) {
            // Update the app to reflect a signed in user
            // Hide the sign-in button now that the user is authorized, for example:
            document.getElementById('signinButton').setAttribute('style',
                    'display: none');
            var request = gapi.client.plus.people.get({
                'userId' : 'me'
            });
            request.execute(function(resp) {
                var email = '';
                if(resp['emails'])
                {
                    for(var i = 0; i < resp['emails'].length; i++)
                    {
                        if(resp['emails'][i]['type'] == 'account')
                        {
                            email = resp['emails'][i]['value'];
                        }
                    }
                }
                alert("email ="+email);
                getUserMail(email);
                console.log('ID: ' + resp.id);
                console.log('Display Name: ' + resp.displayName);
                console.log('Image URL: ' + resp.image.url);
                console.log('Profile URL: ' + resp.url);
            });
        } else {
            alert("login unsuccessful");
            // Update the app to reflect a signed out user
            // Possible error values:
            //   "user_signed_out" - User is signed-out
            //   "access_denied" - User denied access to your app
            //   "immediate_failed" - Could not automatically log in the user
            console.log('Sign-in state: ' + authResult['error']);
        }
    }

HTML code:

<span id="signinButton">
             <span class="g-signin" 
            data-callback="signinCallback"
            data-clientid="*******.apps.googleusercontent.com"
            data-cookiepolicy="single_host_origin" 
            data-scope="profile">
            </span>
    </span>
    </span>
+4
source share
1 answer

Google span.

Google :

<meta name="google-signin-clientid" content="xxxxxxxxxxxxxx.apps.googleusercontent.com" />
<meta name="google-signin-cookiepolicy" content="single_host_origin" />
<meta name="google-signin-callback" content="signinCallback" />
<meta name="google-signin-requestvisibleactions" content="https://schema.org/AddAction" />
<meta name="google-signin-scope" content="https://www.googleapis.com/auth/plus.login" />
<div class="g-signin"><!-- Your button here --></div>

. Google+ (. 4)

0

All Articles