Skip to content
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

Error: The popup was closed #93

Open
youradds opened this issue Dec 25, 2016 · 15 comments
Open

Error: The popup was closed #93

youradds opened this issue Dec 25, 2016 · 15 comments

Comments

@youradds
Copy link

Hi,

I'm currently setting up a local instance of the oauthd daemon. I've got the daemon booting up, and have configured the social media accounts. In the library that gets included, I changed:

oauthd_url:"https://oauth.io"

to:

oauthd_url:"https://oauth.mydomain.com" (where the sub-domain is)

I then reloaded my page, and tried to login. The popup comes up ok (no errors), but then the window just closes. In Firebug, I get:

Error: The popup was closed

I seem to remember reading that if you access it from another domain (like I do, on my dev site), then you sometimes have to delete the app from Facebooks end, to stop it having issues. So I did that, but still no joy :/

Any ideas?

Thanks!

Andy

@bumpmann
Copy link
Contributor

Hi, it looks like it's not opening the popup from a user action (click action...). can you check #86 (comment) ?

btw, if you don't want to change the library you can use OAuth.setOAuthdURL("https://oauth.mydomain.com")

Also, if you did not do it yet you have to add oauth.mydomain.com to the whitelisted domains on your app on https://developers.facebook.com

@youradds
Copy link
Author

Thanks. Just as a test, I updated to the latest oauth-js minified script, but even the bog standard login doesn't seem to work:

https://steampunkjunkies.net/ (click the "person" icon near the top).

This is using the old method (i.e oauth.io). Maybe I have something wrong here?

	$(document).on("click",'.btn-facebook-login',function() {

		OAuth.initialize('CmRGYdnRMWM2ZrOb7M1Nf1_T57o');
		OAuth.popup('facebook').done(function(result) {

				$('#ajax_loading_wrapper').show();

				result.get('/me').done(function(data) {

				$.getJSON(base+'/cgi-bin/login-new.cgi', { do: 'store_session', token: result.access_token, what: 'facebook' }, function(result) {
					var passed_in_url = gup('url'); // in case we are asking them to login - wanna send back there!
					if (window.location.pathname == "/logout") {
						window.location.href=base;
					} else if (passed_in_url != null && passed_in_url.length > 10) {
						window.location.href= passed_in_url;
					} else if (typeof url == "string") {
						window.location.href= url;
					} else {
						location.reload();
					}
		    	});

  			}).fail(function(err) {
  				bootbox.alert("Sorry, there seems to have been an error (1001)");
  				$('#ajax_loading_wrapper').hide();
			});

		}).fail(function(err) {
			console.log(err);
		});
	});

My full JS script can be seen here:

https://steampunkjunkies.net/2017/js/login.js?

I get the popup showing, but it them closes right away with the Error: The popup was closed message in the console.

Thanks :)

@bumpmann
Copy link
Contributor

Hum, i have no problem to connect on chrome / firefox / safari, macos versions (i have no linux / windows machines available for a while). What browser / os / versions do you use and did you test on another ?

@youradds
Copy link
Author

Mmm this is very weird! I tried it on my Mac, and it works fine. Tried it on IE Edge, Chrome and Safari, and all fine. FF however just doesn't want to play ball. I've cleared my cache, and even tried it in a "Private Window" (this didn't work though, but maybe because you can't store cookies / localStorage in a private session?)

I've even tried rebooting Firefox to see if that helped, but I still get the same issue. Odd :/

@bumpmann
Copy link
Contributor

So it's about firefox on mac ? Can you tell me ff version and if you have modules installed ? (you can also try to disable modules to see if it's from that).

Tried on mac / ff 50.1 without any module

@youradds
Copy link
Author

Hi,

OK, so this is really weird! I disabled all of my add-ons in FF, and it then worked. So I went through and enabled/disabled them, until I found the one causing the issue:

https://addons.mozilla.org/en-GB/firefox/addon/grammarly-1/

I'm a bit confused as to why it would be causing an issue though!

@youradds
Copy link
Author

Hi,

Mmmm maybe its not that causing it. Now I have the daemon setup on the server, I'm pointing to that. An example URL:

https://steampunkjunkies.net/cgi-bin/page.cgi?test=1

(only that URL will use the new code for now)

If I test it in IE, Edge or Chrome, it works fine. As soon as I try it in FF it does the same thing (the popup has closed). That is will all of the add-ons disabled, and FF restarted. Very odd issue :/

@youradds
Copy link
Author

Yeah - there must be something up. On this page:
https://steampunkjunkies.net/cgi-bin/page.cgi?test=1

In every browser, I just get a popup opening and then instantly closing. Here is a screencast I took:

2016-12-28 at 08-06-24.zip

I tried stepping through it to see the error message coming up, but it opens and closes so fast, I can't see anything. The annoying part is that even in Firebug nothing comes up, as its a new popup

@bumpmann
Copy link
Contributor

Looking at the console, i get the error "Error: Origin "https://steampunkjunkies.net/cgi-bin/page.cgi?test=1" does not match any registered domain/url on oauth.steampunkjunkies.net"

Did you add the domain on your app on oauthd admin ?

@youradds
Copy link
Author

Oh weird. Looks like I didn't. It still doesn't seem to want to work for me though:

2016-12-28 at 11-12-00

Does that look right?

Also, how are you seeing this in console? For me I don't get anything. Is there a trick to view the contents of a popup?

Thanks!

@bumpmann
Copy link
Contributor

Hum not sure what happened but it works now (cache?) The error was in the ff console, nothing special.

@bumpmann
Copy link
Contributor

Having installed grammarly this does not change and still connects me

@youradds
Copy link
Author

youradds commented Dec 28, 2016

Mmm really? Doesn't work for me :/ In a private window, I logged in with FB, then it came back with our custom error popup:

Sorry, there seems to have been an error (1001)

(from login2.js, with a fail())

I still can't seem to spot anything going on the FF console (it only seems to scope the normal page, and ignore the popup - even with "persistent" enabled)

Having installed grammarly this does not change and still connects me

Yeah, I guess that was a false positive. Not sure why it started working after disabling that, but now it doesn't help if I disable and reboot. Odd one!

@bumpmann
Copy link
Contributor

In a private window fb was failing the request https://graph.facebook.com/me?access_token=xxxx because of this https://support.mozilla.org/en-US/kb/tracking-protection-pbm but no problem with twitter or the protection disabled
screen shot 2016-12-28 at 12 38 16

@youradds
Copy link
Author

Ahhhh got it! There must have been a dud cookie in there. I cleared out my cookies, and now it works for me :) Thanks for sticking at it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants