javascript - Google sign in API does not work on Mozilla Firefox -


i handling web app requires user sign in using google account gain access core functionalities. when using google chrome works way it's expected work: user clicks "sign in", pop-up opens google sign in form, user signs in, , transferred main page. (good)

however

when using mozilla firefox 38.0.1, web app cannot used in way because when user clicks "sign in", nothing. literally nothing, not error on console.

here login button:

//head <meta name="google-signin-client_id" content="{client id}.apps.googleusercontent.com">  //body <button class="g-signin2 login-button" data-onsuccess="onsignin"></button> 

is there known issue firefox , google sign in api?

ok, found solution: followed this. basically, didnt use easy integration of google signin , created custom handler , listeners. kept original buttons because required , added javascript:

html

<script src="https://apis.google.com/js/plus.js?onload=appstart"></script> 

js

//googlesignin.js  var auth2; // sign-in object. var googleuser; // current user. /**  * calls startauth after sign in v2 finishes setting up.  */ var appstart = function() {   console.log('appstart()')   gapi.load('auth2', initsigninv2); }; /**  * initializes signin v2 , sets listeners.  */ var initsigninv2 = function() {   auth2 = gapi.auth2.getauthinstance({       client_id: '{client id}.apps.googleusercontent.com',       scope: 'profile'   });    // listen sign-in state changes.   auth2.issignedin.listen(signinchanged);   // listen changes current user.   auth2.currentuser.listen(userchanged);    // sign in user if signed in.   if (auth2.issignedin.get() == true) {       auth2.signin();   } }; /**  * listener method sign-out live value.  *  * @param {boolean} val updated signed out state.  */ var signinchanged = function (val) {     console.log('signin state changed ', val); }; /**  * listener method when user changes.  *  * @param {googleuser} user updated user.  */ var userchanged = function (user) {   console.log('user now: ', user);   googleuser = user; };  $('.login-button').on('click', function() {     console.log('signing in')      auth2.signin().then(function(user) {         //callback handle sign in         onsignin(user);     }); }) 

i'm not sure caused issue of google sign in not work on mozilla. if knows known issue please let me know in comments.

bottomline: easy integration of google sign in did not work on mozilla. had integrate using listeners.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -