Is your feature request related to a problem? Please describe.
The current BrowserOAuthClient implementation relies on Web APIs that are restricted or unavailable in Chrome Extension contexts.
Web-specific APIs used:
window.location for redirect handling
localStorage for session persistence
window.open() for popups
BroadcastChannel for cross-context messaging
History API for state management
Describe the solution you'd like
Add pluggable providers to support both web and extension environments through configuration:
Storage provider (chrome.storage.local)
Location provider (chrome.runtime.getURL)
Popup provider (chrome.windows.create)
Messaging provider (chrome.runtime.connect)
This enhancement would enable Chrome Extension support while maintaining the existing web functionality through a single, configurable implementation.
Describe alternatives you've considered
Extending the OAuthClient and implementing a Chrome extension version was straightforward. Because you can leverage chrome.identity.launchWebAuthFlow, the window management and popups don't require management, and the implementation is more straightforward. The drawback is that you would have to provide implementations for the IndexedDB and encryption runtimes, which are the same ones that BrowserOAuthClient uses and seem redundant.
Is your feature request related to a problem? Please describe.
The current BrowserOAuthClient implementation relies on Web APIs that are restricted or unavailable in Chrome Extension contexts.
Web-specific APIs used:
Describe the solution you'd like
Add pluggable providers to support both web and extension environments through configuration: Storage provider (chrome.storage.local) Location provider (chrome.runtime.getURL) Popup provider (chrome.windows.create) Messaging provider (chrome.runtime.connect)
This enhancement would enable Chrome Extension support while maintaining the existing web functionality through a single, configurable implementation.
Describe alternatives you've considered
Extending the OAuthClient and implementing a Chrome extension version was straightforward. Because you can leverage chrome.identity.launchWebAuthFlow, the window management and popups don't require management, and the implementation is more straightforward. The drawback is that you would have to provide implementations for the IndexedDB and encryption runtimes, which are the same ones that BrowserOAuthClient uses and seem redundant.
I have a basic implementation of that in vanilla JS here: https://gist.github.com/kevinmcmahon/82b96fb10685d93eaff53801b2d2adc0