Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why did GoogleAuth.then() stop calling callbacks?

My application relies on Google Sign-In. Suddenly, today, the GoogleAuth.then() method has stopped calling its callbacks. This code does nothing (printing neither result):

gapi.auth2.init({
    client_id: 'MYID.apps.googleusercontent.com',
    scope: 'profile email'
}).then(function() {
    console.log("success called");
}, function() {
    console.log("failure called")
});

This code does nothing even though using other methods to interrogate signin (such as creating listeners on isSignedIn and currentUser) work correctly.

Our code hasn't changed, but this breakage appears to be slowly rolling across our customer base in what feels vaguely like Google doing some sort of rolling deployment. At the moment this problem is a couple hours old. It has stopped working on my laptop but still works on my phone. A number of our customers around the world are experiencing different results.

Is this a Google bug? How do I report it to someone?

like image 629
stickfigure Avatar asked Nov 06 '15 03:11

stickfigure


1 Answers

I was today having similar problem as I had needed a quick hack for

<div class="g-signin2" data-onsuccess="onSignIn">

not working, I call it now it this way.:

   <script src="https://apis.google.com/js/platform.js?onload=sss"
async defer></script>

function sss() {
    auth2 = gapi.auth2.getAuthInstance();
    auth2.isSignedIn.listen(
        function(isSigned){
            if (isSigned) onSignIn(window._auth2.currentUser.get());
            else signOut();
       })
    }

It works.

like image 81
user1251486 Avatar answered Jan 03 '23 15:01

user1251486