The way OAuth works inside chrome extension is with chrome.identity.launchWebAuthFlow, but you cannot use this inside popup extension because the call will open a new popup causing original extension popup to loose focus and close (so the oauth callback will never work!!).

The solution to me is: inside popup:

RemoteStorage.Authorize.getLocation = chrome.identity.getRedirectURL

Generates a redirect URL to be used in |launchWebAuthFlow|.
The generated URLs match the pattern https://<app-id>.chromiumapp.org/*.

This is needed as the url of extension is something like chrome://extension-idthen from popup, let's send a message to background chrome extension