-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Erratic behavior: Popup window do not close #629
Comments
Have you tried it on https://satellizer.herokuapp.com? I will need more information to know why the popup did not close. What you saw inside the popup is a normal behavior. It redirects to itself, grabs the |
I have tried the app. It is hard to me to get more information. If I get anything I will post here. Maybe it is something related with AngularJS and |
Satellizer: AngularJS When the authentication succeed, my server receive two requests: When it fails, it receive only the The POST request is sent by the main window after the popup is closed, right? Reading the Satellizer source code, I saw a piece of code like this during the popup pooling:
I will try to investigate if I am getting some error there. |
Hi @paulocheque. Did you find why is this happening? |
Not really, but I have two hypothesis:
I made many changes and it appears to have fixed. Thanks! |
@paulocheque @nass600 Can you try something for me? Edit satellizer.js code starting on line 753. Add console.log here and comment out the line which closes the popup. if (popupWindowOrigin === documentOrigin && (Popup.popupWindow.location.search || Popup.popupWindow.location.hash)) {
var queryParams = Popup.popupWindow.location.search.substring(1).replace(/\/$/, '');
var hashParams = Popup.popupWindow.location.hash.substring(1).replace(/[\/$]/, '');
var hash = utils.parseQueryString(hashParams);
var qs = utils.parseQueryString(queryParams);
// Print current URL location to console
console.log(Popup.popupWindow.location);
angular.extend(qs, hash);
if (qs.error) {
deferred.reject(qs);
} else {
deferred.resolve(qs);
}
$interval.cancel(polling);
// Do not close the popup
//Popup.popupWindow.close();
} Then click on this popup and open Chrome Developer Tools to check console output, as well as potential errors that could cause this issue. |
One more thing, @paulocheque are you doing any page redirects on root path? For example, when you go to http://yoursite.com, does it try to automatically take you to http://yoursite.com/login? |
My problem is I am not getting anything in (Popup.popupWindow.location.search || Popup.popupWindow.location.hash) so that way the flow does not reach the if clause and therefore the popup is not being closed. Maybe it has something to do with cache as @paulocheque suggests so I am going to try the random query param trick to see if this solves the issue. Thanks guys |
Well, after some hours of research I have narrowed the error to a cache issue in the angular application web server (Nginx). The random query param didn't work for me all the time. I have page redirects on root path and they don't seem to affect the behaviour. The lines I added to the virtual hosts were: location / {
if_modified_since off;
add_header Last-Modified "";
} Not sure if this is correct patch (because now the app loads slower) but it works for me right now. |
Hey, some of you might be having the same problem as mine of the popupWindowOrigin not being equal as the redirectUri. It makes some authentication methods work and other not to work. In my case Facebook worked but Google didn't. I fixed it by adding the following code at line 752. It removes any trailing slashes:
|
@nass600 check out this issue #727 - I had problem very similar to yours, and although I was also suspecting nginx at the beginning, I figured out later that the problem was in query params being hijacked by uiRouter's redirect. I still think that caching is somehow involved with all this but more as a mean that manifested the real problem, not the cause. |
I'll check the issue. Thanks @Martinsos |
This bug still persists on iOS Firefox with 0.14.* @sahat |
I had a similar issue where the popup was closing for some users and not for others. In the end, it turns out it happened because some users had been visiting www.example.com and others example.com. This causes the The solution was to force all users to the non-www url. |
@nass600 @aligajani |
@chungconscious True, it works for me most of the time though. |
Adding a note that it's still not solved for us. Problem happens on Chrome at about 70% of the login attempts (with FB or Linkedin) and a 100% of the attempts on Safari. Help!! |
@knigal This sounds a lot like the problem that I had, I described it, including the solution, here: #727 - I recommend you give it a look. |
Thanks @Martinsos your tip is right on target in my case. A couple of days ago we solved the issue similarly. That's quite good since login stopped working completely in Safari, and panic was creeping in :-0 In case it'd be of use to others, I'll add a short summary: I tracked down the problem to Satellizer's if (popupWindowPath === redirectUriPath) { This lines confirms that the url of the popup is same as value of the provider's redirectUri. $urlRouterProvider.when('/', () => {
$state.transitionTo('some.other.state');
}); I've added some logging which exposed that the value of if ("https://app.mapme.com" === "https://app.mapme.com/other/path") { So the authentication was completed successfully, but the root fwd rule was messing things up. To fix it, I ended up doing as following:
.config(function ($authProvider) {
$authProvider.baseUrl = ... ;
const redirectUri = window.location.origin + '/auth-endpoint';
$authProvider.facebook({
clientId: appId,
redirectUri,
});
$stateProvider.state('authEndpoint', {
url: '/auth-endpoint',
})
Once all that was set up, Satellizer's polling function always unblocked and the authentication popup closed So, the issue is 100% solved for me. Thanks everyone! |
This is an erratic error. I dont know if it is a browser cache, satellizer issue or Provider's issue. I thought it would be a Google issue because of this: google/google-api-javascript-client#74
But I faced this issue with LinkedIn too.
Then the popup does not close and the website refresh itself in the popup.
Any ideas?
Thanks in advance
The text was updated successfully, but these errors were encountered: