maximepvrt / angular-google-gapi

An AngularJS module for using all Google Apis and your Google Cloud Endpoints (Google App Engine) with OAuth. This module uses Google APIs Client Library for JavaScript, available for all GApis.
176 stars 111 forks source link

Login Pop-up is always blocked #78

Open edcolmar opened 7 years ago

edcolmar commented 7 years ago

I followed the login process in the readme, but my login popup is always blocked. Is there a workaround/solution?

edcolmar commented 7 years ago

Still having a hard time with this. In some cases the popup is not blocked, and in others it is. FF seems to be ok with it, but Chrome blocks it, if in incogneto mode, or if using a chrome that has not visited the site already. I am seeing the same behavior on the live demo. Please advise.

edcolmar commented 7 years ago

There are google auth sites which use the popup, and the popup is not blocked. I know that a user can individually allow popups, but this is unacceptable. Please advise.

edcolmar commented 7 years ago

Hi Simon

There are google auth sites that use the popup login method, but are not blocked by chrome.

I know that users can individually disable popup blocking locally, but this is an unacceptable solution.

Is it possible to bypass the popup blocker by default?

-Ed

On Tue, Oct 25, 2016 at 5:55 AM, Simon Egersand notifications@github.com wrote:

This has nothing to do with the component but with the browser. Your browser are blocking the popup from appearing. Here's some instructions https://productforums.google.com/forum/#!msg/chrome/m-WfaAOYRyA/lBrW0mIdE5gJ I found which I think will be helpful.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/maximepvrt/angular-google-gapi/issues/78#issuecomment-256014322, or mute the thread https://github.com/notifications/unsubscribe-auth/AAzUkzJ2wchhU8zVCRo-XAHHk8TgMMdWks5q3e4WgaJpZM4KUU9D .

fernando-lopez commented 7 years ago

Have you seen this FAQ seccion https://github.com/maximepvrt/angular-google-gapi#signup-with-google?

Have you checked the GAuth.login() method is launched by a user action (click) in a HTML element?

We are working in that way, and we have never faced the issue.

If you try to run the GAuth.login() without a user acction, for example when the main page is loading, the popup is blocked.

edcolmar commented 7 years ago

Thanks for the replies. I've moved on to a different solution.

For other people who may want to use this, can someone update the demo to show how it should be done?

https://maximepvrt.github.io/angular-google-gapi/#/login

-Ed

On Tue, Nov 22, 2016 at 4:17 AM, Fernando Lopez notifications@github.com wrote:

Have you seen this FAQ seccion https://github.com/maximepvrt/ angular-google-gapi#signup-with-google?

Have you checked the GAuth.login() method is launched by a user action (click) in a HTML element?

We are working in that way, and we have never faced the issue.

If you try to run the GAuth.login() without a user acction, for example when the main page is loading, the popup is blocked.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/maximepvrt/angular-google-gapi/issues/78#issuecomment-262214602, or mute the thread https://github.com/notifications/unsubscribe-auth/AAzUk-YYpOsSuzmZ2DVvT2YQRMC7UNgMks5rAs81gaJpZM4KUU9D .

dmc31a42 commented 6 years ago

my login page also blocked by popup blocker. i've seen #68, it said login() must be called directly. but in https://github.com/maximepvrt/angular-google-gapi/blob/f5a5aac98f8b6e44c86aebffaae1d02123ff9323/src/factories/GAuth.factory.js#L45-L46 , when module is not loaded, asynchronous loading happened. i modify from A: to B: locally and it work i expect A(original):

else {
  load().then(function (){
    executeSignin(mode, authorizeCallback);
  });
}

B:

else {
  load();
  executeSignin(mode, authorizeCallback);
}
dmc31a42 commented 6 years ago

or @edcolmar you can try using example code without modify angular-google-gapi.js from: https://github.com/maximepvrt/angular-google-gapi/blob/d18b1b808947d4bd465f0788c032fa2e08da3e4b/app/controller.login.js#L3-L28

to:

controller.controller('angular-google-api-example.controller.login', ['$scope', 'GAuth', 'GData', '$state', '$cookies',
    function clientList($scope, GAuth, GData, $state, $cookies) {
        if(GData.isLogin()){
            $state.go('home');
        }
        GAuth.load();

        var ifLogin = function() {
            $cookies.put('userId', GData.getUserId());
            $state.go('home');
        };

        $scope.doLogin = function() {
            GAuth.login().then(function(){
                ifLogin();
            });
        }
    }
])