EddyVerbruggen / cordova-plugin-googleplus

:heavy_plus_sign: Cordova plugin to login with Google Sign-In on iOS and Android
567 stars 629 forks source link

"Infinite loading" when choosing another Google account to login #494

Open LucasPiacitelli opened 6 years ago

LucasPiacitelli commented 6 years ago

In my app, the user clicks in a button to login using his Google account. Then, a window appears requesting to the user which one he wants to use to login (I have more than one account connected to my Android for testing purposes). When the user clicks in "Use another account", another window pop up asking for email and password or to create a new one. When the user finish the steps (login or create), the window closes and doesn't do anything more when, in fact, the app should login using the user info provided by the plugin. The plugin doesn't return an object (like success or error callback). So I would like to know if there's something that I'm doing wrong or if this is really a bug. My snippet:

$('#btn-logar-google').on('click', function() {

window.plugins.googleplus.login({
        'scopes': 'https://www.googleapis.com/auth/user.emails.read profile email', // optional - space-separated list of scopes, If not included or empty, defaults to `profile` and `email`.
        'webClientId': '', // optional - clientId of your Web application from Credentials settings of your project - On Android, this MUST be included to get an idToken. On iOS, it is not required.
        'offline': false, // Optional, but requires the webClientId - if set to true the plugin will also return a serverAuthCode, which can be used to grant offline access to a non-Google server
        },
        function (obj) {
            app_funcoes.loginGoogle(obj.email, obj.displayName);
        },
        function (msg) {
            navigator.notification.alert("Não foi possível realizar o cadastro com sua conta Google pois o acesso às suas informações foi negado", '', 'Permissão negada', 'OK');
        }
    );
});
jorgegc21 commented 6 years ago

I have exactly the same issue, it works for all the account that i already have on google, but if click use another account, after the process , nothing happens

AFA-janw commented 6 years ago

@Lucaro-P I think I expierence the same thing. In my specific context, I'm creating an Ionic 3 app. When I've linked a new Google account, the current view of my app is covered by a semitransparent black view, which is usually the case if an alert is shown... But, the alert is not there. Seems like it's stuck indeed. However, when I tap the screen again, suddenly I do receive a rejection with a code 8 and a message "INTERNAL_ERROR". It's like my app was still visible on screen, but somehow not on the foreground anymore and therefore the loading seemed infinite. Can you confirm if you can stop the 'inifite loading' once you tap your screen again after the account adding process is done?

Whenever I try to login after this issue, everything works fine. Now I'm hoping for an immediately working scenario...

LucasPiacitelli commented 6 years ago

@AFA-janw yeah, that's exactly my scenario right now. Like you said, when I try again later (choosing the account that is now registered in my Android), everything works fine. I didn't find a workaround for this yet, mostly because I don't know how to manipulate the plugin code, so it's totally out of my reach.

jorgegc21 commented 6 years ago

@AFA-janw mine too is an ionic3 app. Same thing happens to me, if i click, overlay dissapear and sends me error 8. If i click again in Google button, sign in occurs.

Still havent found a workaround, seems like a bug,

kamwoz commented 6 years ago

Did anyone found workaround? Same issue here. Click login() method does nothing, no request sent from browser

Ok found solution for my problem (I guess it will not fix everyone issue). It was cordova-plugin-firebase plugin. After I removed it, google sign in started working properly. As far as I know there are few other plugins that can cause this problem

trandangninh commented 6 years ago

I had same issue, this issue only happened with adding the new account, callback is not called until user touch on screen once again

GuyoST commented 6 years ago

Did anyone found workaround? Same issue here. Click login() method does nothing, no request sent from browser

Ok found solution for my problem (I guess it will not fix everyone issue). It was cordova-plugin-firebase plugin. After I removed it, google sign in started working properly. As far as I know there are few other plugins that can cause this problem

Hello, Did you find a solution to use cordova-plugin-firebase at same time ? I would like to use both for my project.