Was having same problem. Seems browser(s) (or at least chrome) will block any "window.open" call which it was invoked not as part of a user interaction.
Refer to here for a deeper explanation.
__
I used to have this next code inside click event listener:
gapi.load('auth2', function() {
var auth2 = gapi.auth2.init({
client_id: '.apps.googleusercontent.com',
fetch_basic_profile: true,
scope: 'profile'
});
auth2.signIn()
.then(function() {
var profile = auth2.currentUser.get().getBasicProfile();
...
})
.catch(function(err) { ... });
});
Note the asynchronous way of loading 'auth2', which is how google docu says.
I changed it to:
// way earlier, before click event can happen
// we call the gapi.load method.
gapi.load('auth2', function() {});
Then, inside click event handler, we can do:
var auth2 = gapi.auth2.init({
client_id: '.apps.googleusercontent.com',
fetch_basic_profile: true,
scope: 'profile'
});
auth2.signIn()
.then(function() { ... })
.catch(function(err) { ... });
... so browser does not block google login popup