<html>
<head>
<meta name="google-signin-client_id" content="MY_CLIENT_ID.apps.googleusercontent.com" />
</head>
<body>
<div class="g-signin2" data-onsuccess="onSignIn"></div>
<script src="https://apis.google.com/js/platform.js" async defer></script>
<script type="text/javascript">
function onSignIn(googleUser) {
console.log("Succesfully Singed in!!!");
}
</script>
</body>
</html>
With the above I can see a google-sign-in button which opens a pop-up accepts credential and signs me in. But I expect onSignIn method to be triggered when the sign in is successful, which is NOT happening. Does anyone have any pointers at this?
Tried it on apache server on osx with safari, chrome and firefox browsers
Check Developers Console and see if Authorized redirect URIs is pointing to the origin you are running the JavaScript?
In my case : The callback function was inside the body tag
.
Callback function not work if it is in body tag, move it to head tag.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With