From 55149670da4d56a6242e16c09977d40f44c54674 Mon Sep 17 00:00:00 2001 From: Hristo Terezov Date: Wed, 27 Feb 2019 15:29:41 +0000 Subject: [PATCH] fix(dropbox-auth): In Electron. --- modules/API/external/electronPopupsConfig.json | 6 ++++++ react/features/dropbox/functions.web.js | 6 ++---- static/oauth.html | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/API/external/electronPopupsConfig.json b/modules/API/external/electronPopupsConfig.json index 1bef15060..5b27cb9e3 100644 --- a/modules/API/external/electronPopupsConfig.json +++ b/modules/API/external/electronPopupsConfig.json @@ -4,5 +4,11 @@ "url": "accounts.google.com" }, "target": "electron" + }, + "dropbox-auth": { + "matchPatterns": { + "url": "dropbox.com/oauth2/authorize" + }, + "target": "electron" } } diff --git a/react/features/dropbox/functions.web.js b/react/features/dropbox/functions.web.js index 244060e7b..2fdfe7e9b 100644 --- a/react/features/dropbox/functions.web.js +++ b/react/features/dropbox/functions.web.js @@ -23,12 +23,10 @@ function authorize(authUrl: string): Promise { return new Promise(resolve => { const popup = window.open(authUrl, windowName); - gloabalNS.oauthCallbacks[windowName] = () => { - const returnURL = popup.location.href; - + gloabalNS.oauthCallbacks[windowName] = url => { popup.close(); delete gloabalNS.oauthCallbacks.windowName; - resolve(returnURL); + resolve(url); }; }); } diff --git a/static/oauth.html b/static/oauth.html index c876db56d..b5e082e6d 100644 --- a/static/oauth.html +++ b/static/oauth.html @@ -16,7 +16,7 @@ if (globalNS.oauthCallbacks && typeof globalNS.oauthCallbacks[windowName] === 'function') { - globalNS.oauthCallbacks[windowName](); + globalNS.oauthCallbacks[windowName](window.location.href); } } })();