browser.identity.launchWebAuthFlow hangs after authentication

When using browser.identity.launchWebAuthFlow with Google OAuth, everything works fine except that once I’ve authenticated with Google, the window that was used for auth hangs. The status is “Waiting for accounts.google.com…”, with the URL being “https://accounts.google.co.uk/accounts/SetSID”. After about two minutes, the status changes to “Connecting to .extensions.allizom.org…”, and about a minute after that, the window closes and fulfils the promise from browser.identity.launchWebAuthFlow.

If I close the window manually once I’ve authenticated with Google, it seems authentication still succeeded since the next call to browser.identity.launchWebAuthFlow works without a prompt.

This happens with the google-userinfo sample: https://github.com/mdn/webextensions-examples/tree/master/google-userinfo

If anybody has any ideas what the cause is or how to fix it, that’d be much appreciated.

Thanks!

That seems like an issue with the google oAuth flow and not Firefox, where google is taking a long time to redirect you.

It feels more like an issue with Firefox, as though it’s actually trying to connect to extensions.allizom.org rather than intercepting the redirect (which is what I assume is meant to happen, since trying to access the redirect URL results in a connection failure). Using the same flow with other redirect URLs works without an issue.

Having said that, I’m by no means an expert on how the flow is meant to work inside in a web extension, so happy to be corrected.

Hi,

I am facing the same issue, have you had the chance to find a workaround?

I am tempted to set the interactive flag to false so that the prompt to authenticate never appears, and add a notification that Signing in with Google only works if the user is already authenticated.

No, I haven’t found a workaround I’m afraid.

We’re experiencing the same issue too. There is an open issue about this on Bugzilla, FYI.

An advise by Shane Caraveo to change the pref extensions.webextensions.identity.redirectDomain to use extensions.mozilla.org, even though probably not a real solution, made it work.

I faced a similar problem when starting launchWebAuthFlow() from a script loaded from the extension popup window HTML code. The problem went away when I changed to calling it from a background script. Maybe this will help someone.

Hi @Greg_Kochaniak
Can you provide a sample code to show us how you did that ?
My authentification flow is broken and I can’t see how to fix it.

Regards.

For me it was endless experimentation, and it still does not work quite well, upon each try to save an article to Drive it prompts me endlessly to choose the account. Somehow it all was much easier under Chrome. I have no time or strength left to fix that last bit (prompt to long-choose account on each try to save). I’ll attach a zip with my source code of this plugin, but if someone figures out how to avoid the account/login issue, please let me know.

(will have to upload the source some other way, stupid Gmail tells me that the zip file with Javascript sources is “blocked for security reasons”)

Greg

For me it was endless experimentation, and it still does not work quite well, upon each try to save an article to Drive it prompts me endlessly to choose the account. Somehow it all was much easier under Chrome. I have no time or strength left to fix that last bit (prompt to long-choose account on each try to save). I’ll attach a zip with my source code of this plugin, but if someone figures out how to avoid the account/login issue, please let me know.

Forget it. “New users cannot upload attachments” here. If you want this source, contact me directly by email, address on contacts page of hyperionics dot com.

Greg