5

So I am running into an interesting issue and would like some opinions. So I have a chrome extension that I am porting over to a firefox extension. Everything is working perfect besides this stupid issue I am having. Basically, when I initiate launchWebAuthFlow, the oauth2 window pops up like it should, but for some reason in firefox it closes the extension window when the oauth2 popup opens, which completely voids the login process since the extension is closed. On chrome, when the oauth2 page opens the extension window still stays open, but in firefox it closes immediately. It seems to be because in firefox they open the oauth2 page in a completely new firefox window instead of the nice little popup chrome does. Does anyone have any experience with this issue and perhaps have a fix or workaround? I do not really think I need to attach code to this but I will for the lols.

    chrome.identity.launchWebAuthFlow(
        { url: auth_url, interactive: true },
        function (redirect_url) {

CodingIsFun33
  • 433
  • 3
  • 14
  • same problem here. Did you find a solution? – andrea.spot. Sep 17 '20 at 07:12
  • @andrea.spot. yeah I found a solution, give me a bit and ill answer this questions with my solution when I have a few mins. – CodingIsFun33 Sep 17 '20 at 22:07
  • 1
    Any update on this? Ran into the same issue. – Karl Oct 16 '20 at 06:19
  • @Karl I ended up basically setting up my oauth2 in a background script and had it activate on extension button click. – CodingIsFun33 Oct 17 '20 at 02:23
  • 1
    Can you give a snippet on how you have done it? I'm facing the same problem, can't get the token after the user authorizes because it closes.. – Pedro Silva Nov 11 '20 at 23:04
  • Pinging for same issue as @PedroSilva. Did you have any luck? – Matt Kenefick Mar 28 '21 at 16:45
  • 1
    Yeah I did, basically I moved the launcWebAuthFlow call to the background script. For that, I used this repo https://github.com/mozilla/webextension-polyfill it has the backs. If you want a real example, here is mine https://github.com/PedroS11/twitch-live-extension/blob/master/src/background.ts The store sends a message to the backgorund script for a token (fetchToken method), and then just return it Hope it helps you – Pedro Silva Mar 31 '21 at 23:32

0 Answers0