oauth-io / oauth-js

OAuth that just works ! This is the JavaScript SDK for OAuth.io

Home Page:https://oauth.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Popup is closed

ptbrowne opened this issue · comments

Hi,

Since recently, I have a problem with OAuthJS with the popup method. I use the last version of OAuthJS from master.

On my site (https://gethupp.com), with Chrome Canary (52.0), I get the "Error: The popup was closed", on my oauthd server, I have the same error.

However on Chrome (50.0), on my site I have the same error but on the oauthd server I do not have it.

I have no idea how to debug that. Do you have any lead ?

Thanks !

Hey Ptbrowne!

I was struggling with this same issue for a couple of hours but was able to get something working.

Tracing the problem from the error message in the OAuth library, I noticed that the error does not necessarily result from some invalid response from the OAuth protocol but was based on whether we had received a message by the time the window was closed or dereferenced. I wasn't too confident in this checking because networking is never an orderly process and browsers can sometimes change event orderings. By tinkering with the interval rate of the closed window check, I was able to tell that we were receiving the correct information from our service and that the OAuth package was prematurely hanging up on the connection.

Would someone familiar (@bumpmann) with the library tell us if this is expected behavior or provide some insight as to the design? If this is a flaw, I'm happy to spend some time to try to find and implement a solution.

Thanks!

This is the expected behavior only when the popup is closed without having received the response (allow, deny, an error etc.). I guess the real cause is because it can't receive the message on time or something blocked it but i think that chrome is sending immediately (~event queue) the window message and don't need a delay, that would be to check.

If you don't see the popup or on a very short time, it may also be that you are using an extension (not sure what would cause that) or that you misplaced the popup invocation that must be in a direct user action (click...). You can replace the popup() with window.open('http://google.com', '_blank') if you're not sure.

Any news since chrome is 53?