I would like to use the API from a browser extension. With WebExtensions, I should be able to support Firefox and Chrome with the same code.
Chrome provides an identity
API for OAuth2, and so does Firefox. These also provide a redirect URI based on the extension ID.
However, the redirect URIs differ depending on the browser. For example, Chrome uses the form https://<app-id>.chromiumapp.org/
while Firefox uses the form https://<app-id>.extensions.allizom.org/
. I assume other browsers (Opera? Vivaldi? Edge if/when it implements identity
?) will use other base domains.
Would it be possible to add more than one OAuth domain without creating a different API key?
For example, Google, Facebook, etc., support this.
There's a couple of alternatives, none of them nice:
- Using the StackExchange domain would mean a manual implementation of OAuth, rather than the convenient API
- Using a custom domain and to redirectredirecting to the correct one would work, but requires maintaining another domain and also introduces an unnecessary external dependency to the extension. I'd like my extension to continue working even if my servers go down.