Files
bruno/packages/bruno-electron/src/utils/deeplink.js
lohit 231776ca4b feat: use default browser for oauth2 authorization bru-2167 (#6101)
* feat: use default browser for oauth2 authorization bru-2167

* fix: coderabbit review comment fixes

* fix: coderabbit review comment fixes

* fix: protocol registration updates

* fix: coderabbit review comment suggestions

* fix: oauth2 auth form use system browser option
2025-12-16 17:23:49 +05:30

31 lines
813 B
JavaScript

const { handleOauth2ProtocolUrl } = require('./oauth2-protocol-handler');
// Store appProtocolUrl - will be handled in the `did-finish-load` event handler
const getAppProtocolUrlFromArgv = (argv) => {
return argv.find((arg) => arg.startsWith('bruno://'));
};
// Handle app protocol URLs
const handleAppProtocolUrl = (url) => {
// Handle OAuth2 callback URLs - `bruno://app/oauth2/callback`
if (isOauth2Url(url)) {
handleOauth2ProtocolUrl(url);
}
return;
};
const isOauth2Url = (url) => {
try {
const urlObj = new URL(url);
if (urlObj.pathname === '/oauth2/callback') {
return true;
}
} catch (error) {
console.error('[Protocol Handler] Error handling protocol URL:', error);
}
return false;
};
module.exports = { handleAppProtocolUrl, getAppProtocolUrlFromArgv };